Skip to content

Commit

Permalink
eng for string
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyingwang committed Nov 23, 2024
1 parent c665042 commit 1a52cd8
Show file tree
Hide file tree
Showing 22 changed files with 218 additions and 240 deletions.
6 changes: 3 additions & 3 deletions mapping/racket/base/generic-numerics.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
;random-sample

;; 4.3.2.9 Number–String Conversions
>>> number->string 米化􏷁
>>> string->number 􏷁化米
>>> real->decimal-string 宩化􏹔􏷁 @elem{将@racket[宩]转化成@racket[􏹔]@racket[􏷁]}
>>> number->string 米化句
>>> string->number 句化米
>>> real->decimal-string 宩化􏹔 @elem{将@racket[宩]转化成@racket[􏹔]@racket[]}
;; >>> integer-bytes->integer ->?integer-bytes->integer
;; >>> integer->integer-bytes ->?integer->integer-bytes
;; >>> floating-point-bytes->real ->?floating-point-bytes->real
Expand Down
4 changes: 2 additions & 2 deletions mapping/racket/base/keywords.rkt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#lang at-exp s-exp "../../../private/mapping-lang.rkt"

>>> keyword? 􏶿?
>>> keyword->string 􏶿化􏷁
>>> string->keyword 􏷁化􏶿
>>> keyword->string 􏶿化句
>>> string->keyword 句化􏶿
>>> keyword<? 􏶿<?
60 changes: 30 additions & 30 deletions mapping/racket/base/string.rkt
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
#lang at-exp s-exp "../../../private/mapping-lang.rkt"


>>> string? 􏷁? ; keyword 􏶿 ; symbol 勺
>>> string 􏷁 "创建一个内容可变的字符串数据结构" ;; TODO: create all the procedures started with 易 to 坚
>>> make-string 􏼅 @elem{构造内容是若干个相同元素的@racket[􏷁]} ;复􏷁
>>> string->immutable-string 􏽁化 @elem{把@racket[􏽀]转变为@racket[􏽁]}
>>> string-length 􏺕 "􏷁的长度" ;􏼬 􏷁巨
>>> string-ref 􏼭 "返回􏷁的第N个元素(从0算起)" ; 􏷁弔
>>> string-set! 􏼘 @elem{直接修改原始数据第N处字(从0算起)为某字} ;􏷁􏾩 敂! 拘
>>> substring 􏷁􏾝 @elem{返回􏷁第N到M处内容组成的@racket[􏽀]} ;邭 􏷁􏾝
>>> string-copy 􏽀化 @elem{把@elem{􏽁}转化为@elem{􏽀}}
>>> string-copy! 􏼘/以􏾝 @elem{从第N处字(从0算起)开始做覆盖(以另一个􏷁的@racket[􏷁􏾝]结果为内容)} ;􏷁􏾩/以􏾝
>>> string-fill! 􏼅𰅡 "把􏷁的内容全部变成某一个重复的字" ; 􏷁㙏! 􏷁复! 𰅡 𢪎 􏼗化! 􏼗𰅡 􏼗𢪎 􏼗 􏼖
>>> string-append 􏼃 @elem{把很多􏷁连成一个@racket[􏽀]} ; 贯􏷁 􏼱
>>> string-append-immutable 􏼁 @elem{把很多􏷁连成一个@racket[􏽁]} ; 􏼯
>>> string? 句?
>>> string ;; TODO: create all the procedures started with 易 to 坚
>>> make-string 􏼅 ;复句
>>> string->immutable-string 􏽁化
>>> string-length 􏺕 ;􏼬 句巨
>>> string-ref 􏼭 ; 句弔
>>> string-set! 􏼘 ;句􏾩 敂! 拘
>>> substring 句􏾝 ;邭 􏾝
>>> string-copy 􏽀化
>>> string-copy! 􏼘/以􏾝 ;句􏾩/以􏾝
>>> string-fill! 􏼅𰅡 ; 句㙏! 句复! 𰅡 𢪎 􏼗化! 􏼗𰅡 􏼗𢪎 􏼗 􏼖
>>> string-append 􏼃 ; 贯句 􏼱
>>> string-append-immutable 􏼁 (山 􏼃) ; 􏼯

>>> string->list 􏼳 @elem{􏷁化字􏿴:把@racket[􏷁]转化为@racket[􏿴](由@racket[字]组成)} ;􏷁化􏿴
>>> list->string 􏼲 @elem{字􏿴化􏷁:把@racket[􏿴](由@racket[字]组成)转化为@racket[􏷁]} ; 􏿴化􏷁
>>> build-string 􏼄 @elem{构造内容是一系列序数转化成@racket{字}所组成的@racket[􏷁]} ; 序􏷁 􏼔
>>> string=? 􏷁=?
>>> string<? 􏷁<?
>>> string<=? 􏷁<=?
>>> string>? 􏷁>?
>>> string>=? 􏷁>=?
>>> string->list 􏼳 ;句化􏿴
>>> list->string 􏼲 ; 􏿴化句
>>> build-string 􏼄 ; 序句 􏼔
>>> string=? =?
>>> string<? <?
>>> string<=? <=?
>>> string>? >?
>>> string>=? >=?

>>> string-ci=? 􏷁ci=?
>>> string-ci<? 􏷁ci<?
>>> string-ci<=? 􏷁ci<=?
>>> string-ci>? 􏷁ci>?
>>> string-ci>=? 􏷁ci>=?
>>> string-ci=? 句ci=?
>>> string-ci<? 句ci<?
>>> string-ci<=? 句ci<=?
>>> string-ci>? 句ci>?
>>> string-ci>=? 句ci>=?

>>> string-upcase 􏺔 @elem{将􏷁大写化} ;􏼨
>>> string-downcase 􏺓 @elem{将􏷁小写化} ;􏼧
>>> string-titlecase 􏺒 @elem{将􏷁中单词首字母大写化其余小写化} ;􏺒
>>> string-foldcase 􏺓* @elem{将􏷁中单词做CaseFolding处理} ;
>>> string-upcase 􏺔 ;􏼨
>>> string-downcase 􏺓 ;􏼧
>>> string-titlecase 􏺒 ;􏺒
>>> string-foldcase 􏺓* ;
8 changes: 4 additions & 4 deletions mapping/racket/base/symbols.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
>>> symbol? 􏷂?
>>> symbol-interned? 􏺏? (罒 􏷂 ?)
>>> symbol-unreadable? 􏺋? (龱 􏷂 ?)
>>> symbol->string 􏷂化􏷁
>>> string->symbol 􏷁化􏷂
>>> string->uninterned-symbol 􏷁化􏺍
>>> string->unreadable-symbol 􏷁化􏺋
>>> symbol->string 􏷂化句
>>> string->symbol 句化􏷂
>>> string->uninterned-symbol 句化􏺍
>>> string->unreadable-symbol 句化􏺋
>>> gensym 􏺌 (􏺍 米)
>>> symbol<? 􏷂<?
20 changes: 10 additions & 10 deletions mapping/racket/string.rkt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#lang at-exp s-exp "../../private/mapping-lang.rkt"


>>> string-append* 􏼂 @elem{类@racket[􏼱],不过最后一个􏷁是@racket[􏿴]} ;􏼰
>>> string-append* 􏼂 ;􏼰

>>> string-join 􏼪 "把一个􏿴内的各个元素聚集在一块组成􏷁" ; 􏼻
>>> string-split 􏼩 "把􏷁分割并组成􏿴" ;􏼼 􏼼 􏼼
>>> string-join 􏼪 ; 􏼻
>>> string-split 􏼩 ;􏼼 􏼼 􏼼

>>> string-normalize-spaces 􏼛 "内容中的空格回车等字符都简化成一个空格" ; 㲁 椌 𤗇 𤗇 瞾 箜 𭄲 􏷁􏼺 􏼮 􏼛 􏼚
>>> string-replace 􏼥 "将数据内容的一部分更换成另一部分" ;敂
>>> string-normalize-spaces 􏼛 ; 㲁 椌 𤗇 𤗇 瞾 箜 𭄲 􏼺 􏼮 􏼛 􏼚
>>> string-replace 􏼥 ;敂

>>> string-trim 􏼝 @elem{修剪􏷁} ; 􏼡 􏼙
>>> non-empty-string? 􏼟? @elem{非空􏷁?}; 䆜 􏼠 􏻷 􏻶
>>> string-trim 􏼝 ; 􏼡 􏼙
>>> non-empty-string? 􏼟?

>>> string-contains? 􏸶? @elem{某􏷁是否是某􏷁中间的一部分} ;; create a procedure named: 诗含字 􏼴 邭 􏼢
>>> string-prefix? 􏼹? @elem{某􏷁是否是某􏷁起头的一部分} ;; 诗起于字 􏼶 􏼤
>>> string-suffix? 􏼸? @elem{某􏷁是否是某􏷁末尾的一部分} ;; 诗终于字 􏼵􏼣
>>> string-contains? 􏸶? ;; create a procedure named: 诗含字 􏼴 邭 􏼢
>>> string-prefix? 􏼹? ;; 诗起于字 􏼶 􏼤
>>> string-suffix? 􏼸? ;; 诗终于字 􏼵􏼣
;; 玽 欨 劬 眗 竘 𭇕 𮍘 𭴔 𫲢 䪷 𡱈 坸 佝 𠛎 𤖵 𠣪 軥 胊 㽛 玽 岣 驹 夠
2 changes: 1 addition & 1 deletion number.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


(名 (􏹔 N [D 2])
(􏷁化米 (宩化􏹔􏷁 N D)))
(句化米 (宩化􏹔 N D)))

(名 (〇? N)
(𥥪? N))
2 changes: 1 addition & 1 deletion private/scribble-styles/css/cangjie.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions scribblings/ming-lib/core.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
@defform[(mingize module-path)]{
名化(汉化)一个Racket的库。
@itemlist[
@item{仅只用于@racket[require]的子􏷁,且仅当名语言内部已经定义了该库的翻译文件时才会成功。}
@item{当嵌入到@racket[require]中作为子􏷁一块使用时,其和@racket[(require #,(elem "ming/" (racketvarfont "module-path")))]等同。除了后者所使用的翻译表的作用域是在原module中的,因此不能简单的被修改或重定义。}
@item{仅只用于@racket[require]的子句,且仅当名语言内部已经定义了该库的翻译文件时才会成功。}
@item{当嵌入到@racket[require]中作为子句一块使用时,其和@racket[(require #,(elem "ming/" (racketvarfont "module-path")))]等同。除了后者所使用的翻译表的作用域是在原module中的,因此不能简单的被修改或重定义。}
]

@examples[#:eval my-eval
Expand Down
2 changes: 1 addition & 1 deletion scribblings/ming-lib/number.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ boolean?]{
@defproc[(􏹔 [N 米?])
釆?]{
返回小数后保留N位(默认2)的近视值,采用“四舍六入五成双(奇进偶退)法”。
@margin-note{另见:@racket[宩化􏹔􏷁]}
@margin-note{另见:@racket[宩化􏹔]}
@examples[#:eval (the-eval)
(􏹔 0.014)
(􏹔 0.015)
Expand Down
10 changes: 5 additions & 5 deletions scribblings/ming-lib/string.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@(require scribble-rainbow-delimiters)
@script/rainbow-delimiters*

@title[#:tag "ming-string"]{􏷁}
@title[#:tag "ming-string"]{}
@defmodule[ming/string]
Racket标准库@secref["string"]的名语言扩展。
@margin-note{本页所列之例程的实现代码是名语言,因此源代码有参照意义。}
Expand Down Expand Up @@ -42,8 +42,8 @@ Racket标准库@secref["string"]的名语言扩展。
}


@; @defproc[(邭* [STR 􏷁?] [N1 精确非负整数?] [N2 精确非负整数?])
@; 􏷁?]{
@; @defproc[(邭* [STR ?] [N1 精确非负整数?] [N2 精确非负整数?])
@; ?]{
@; @margin-note{另见:@racket[邭]}
@; @examples[#:eval (the-eval)
@; (邭* "abcdefg" 0 2)
Expand All @@ -60,8 +60,8 @@ boolean?]{
}


@defproc[(􏸵 [STR 􏷁?])
􏷁?]{
@defproc[(􏸵 [STR ?])
?]{
@margin-note{
@bold{@litchar{􏸵}为新造字}
@itemlist[
Expand Down
42 changes: 29 additions & 13 deletions scribblings/naming-rules.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

@(require (for-label racket ming ming/list ming/vector ming/hash ming/string)
scribble/example
ming/scribble
scribble-rainbow-delimiters)
@(define the-eval
(make-eval-factory '(racket/base racket/list ming/racket/base ming/racket/list)))
Expand All @@ -16,6 +17,18 @@

@section[#:tag "character-rules"]{Characters}
@margin-note{You may need to read @secref["character-implications"] first.}

@defzi[山]{
@same-as-cnchar-but["" "mountain" "immutable"].
Example: @code{山? 􏻼 􏾐 􏽁}
}

@defzis[水/氵/𭕄]{
@same-as-cnchar-but["" "water" "mutable"].
Example: @code{水? 􏻽 􏾐 􏽀}
}


@tabular[@;#:sep @hspace[0]
#:style 'boxed
#:column-properties '(center)
Expand Down Expand Up @@ -217,7 +230,20 @@
)
]

@section[#:tag "phrase-rules"]{Phrases}
@section[#:tag "word-rules"]{Words}

@defzi[化]{@same-as-cnchar["" "convert"].}
@itemlist[
@item{
In the end of word:means slightly converting data, such as from @zi[山] to @zi[水].
Example: @code{􏻼化 􏽀化 􏽁化}
}
@item{
In the middle of word:means converting data from one type to the other.
Example: {@code{􏻿化􏿴 􏿴化􏻿}}
}
]

@tabular[@;#:sep @hspace[0]
#:style 'boxed
#:column-properties '(center)
Expand All @@ -237,18 +263,7 @@
@; @elem{@racket[序􏿴]、@racket[复􏿴]、@racket[𥸬􏿴]}
@; )

(list
@elem{suffix @bold{@litchar{化}}}
@elem{attribute convert}
@elem{Convert attributes of data, such as from mutable to immutable.}
@elem{@code{􏻼化 􏽀化 􏽁化}}
)
(list
@elem{insert @bold{@litchar{化}}}
@elem{type convert}
@elem{Convert types of data.}
@elem{@code{􏻿化􏿴 􏿴化􏻿}}
)

)
]

Expand All @@ -274,3 +289,4 @@
)
)
]

27 changes: 12 additions & 15 deletions scribblings/racket-lib/hash.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ resemble @zi[􏿰].
@defzi/sub[口]/@defzi/sub[􏶯]/@defzi/sub[􏶮]/@defzi/sub[=] are simplified way to write @zi[同]/@zi[􏷇]/@zi[􏷅]/@zi[冃], which indicate the keys are uniqued by using which comparison procedures.}

@section{􏾐 􏾑}
@defzis[􏾐/􏾑]{resemble @zi[􏿰].
@defzi/sub[山]{@same-as-cnchar-but["" "mountain" "immutable"]};
@defzi/sub[𭕄]{@same-as-cnchar-but["" "water" "mutable"]}.
}
@defzis[􏾐/􏾑]{@zi[山]/@zi[𭕄 ] + @zi[􏿰].}

@section{􏾎 􏾏 􏾈}
@defzis[􏾎/􏾏/􏾈]{
Expand Down Expand Up @@ -137,7 +134,7 @@ resemble @zi[􏿰].



@section+elemref{􏿰􏺈 􏿰􏺇,􏿰日?}
@section{􏿰􏺈 􏿰􏺇,􏿰日?}
@defzi[􏺈]{@zi[日] + @zi[阝], @stands-for{the keys of @racket[􏿰] object.}}
@defzi[􏺇]{@zi[日] + @zi[阝], @stands-for{the values of @racket[􏿰] object.}}
@defzi[明]{@zi[日] + @zi[月], @stands-for{the pair(key+value) of @racket[􏿰] object.}}
Expand All @@ -148,8 +145,8 @@ resemble @zi[􏿰].
]


@; @section+elemref{􏿰􏽚 􏿰𦙨}
@section+elemref{􏿰弔 􏿰𫼛,􏿰􏽙,􏿰􏾘 􏿰􏽘}
@; @section{􏿰􏽚 􏿰𦙨}
@section{􏿰弔 􏿰𫼛,􏿰􏽙,􏿰􏾘 􏿰􏽘}
@defzi[𫼛]{@zi[扌] + @zi[弔]}
{@defzi[􏽙]{@zi[弔] + @zi[日]}
{@defzi[􏾘]{@zi[弔] + @zi[刂]}
Expand Down Expand Up @@ -178,7 +175,7 @@ h
]


@section+elemref{􏿰攸 􏿰攸+,􏿰􏾩 􏿰􏾩+,􏿰攸/入 􏿰􏾩/入}
@section{􏿰攸 􏿰攸+,􏿰􏾩 􏿰􏾩+,􏿰攸/入 􏿰􏾩/入}
@eleph-note{@racket[攸]}
@examples[#:eval (the-eval)
(􏿰攸 (􏿰 'a "apple" 'b "banana") 'b "ba")
Expand All @@ -191,7 +188,7 @@ h
]


@section+elemref{􏿰𠛮 􏿰􏽗,𠛮􏿰}
@section{􏿰𠛮 􏿰􏽗,𠛮􏿰}
@defzi[𠛮]{@zi[全] + @zi[刂].}
@examples[#:eval (the-eval)
(􏿰𠛮 (􏿰 'a "apple" 'b "banana"))
Expand All @@ -201,15 +198,15 @@ h
(𠛮􏿰 (􏿰 'a "apple" 'b "banana"))
]

@section+elemref{􏿰􏷒 􏿰􏷑 􏿰􏷑化􏿴}
@section{􏿰􏷒 􏿰􏷑 􏿰􏷑化􏿴}
@eleph-note{@racket[􏷑]}
@examples[#:eval (the-eval)
(􏿰􏷒 (􏿰 'a "apple" 'b "banana") (入 (K V) (示 K) (示 V)))
(􏿰􏷑 (􏿰 'a "apple" 'b "banana") (入 (K V) (並 V K)))
(􏿰􏷑化􏿴 (􏿰 'a "apple" 'b "banana") (入 (K V) (􏿴 V K)))
]

@section+elemref{􏿰􏺈?^}
@section{􏿰􏺈?^}
@eleph-note{@racket[􏿰􏺈]}
@examples[#:eval (the-eval)
(􏿰􏺈?^ (􏿰 'a "aa" 'b "bb") (􏿰 'a "aaa" 'b "bbb" 'c "ccc"))
Expand All @@ -218,15 +215,15 @@ h
(􏿰􏺈?^ (􏿰 'b "bb") (􏿰 'a "aaa" 'b "bbb" 'c "ccc"))
]

@section+elemref{􏿰巨 􏻵?}
@section{􏿰巨 􏻵?}
@eleph-note{@racket[巨 穴?]}
@defzi[􏻵]{@zi[穴] + @zi[􏿰].}
@examples[#:eval (the-eval)
(􏿰巨 (􏿰 'a "aa" 'b "bb"))
(􏻵? (􏿰 'a "aa" 'b "bb"))
]

@section+elemref{􏾑化}
@section{􏾑化}
@; @margin-note{
@; @bold{@litchar{􏽕}为新造字}
@; @itemlist[
Expand All @@ -241,10 +238,10 @@ h



@section[#:tag "hash-base"]{基础例程}
@section[#:tag "hash-base"]{ming/racket/base}
@defmodule[ming/racket/base]
@defmapping[racket/base/hash]

@section[#:tag "hash-addtional"]{额外例程}
@section[#:tag "hash-addtional"]{ming/racket/hash}
@defmodule[ming/racket/hash]
@defmapping[racket/hash]
6 changes: 3 additions & 3 deletions scribblings/racket-lib/keywords.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ Originates from @secref["keywords" #:doc '(lib "scribblings/reference/reference.
@section[#:tag "nameing-rules-of-keyword"]{Naming Rules}
@secref["naming-rules"]

@section+elemref{􏶿?,􏶿化􏷁、􏷁化􏶿、􏶿化􏽁}
@section+elemref{􏶿?,􏶿化句、句化􏶿、􏶿化􏽁}
@defzi[􏶿]{@mingly-resembles["􏷂" "keyword"]}

@examples[#:eval (the-eval)
(􏶿? '#:keyword)
(􏶿化􏷁 '#:keyword)
(􏶿化句 '#:keyword)
(􏶿化􏽁 '#:keyword)
(􏷁化􏶿 "string")
(句化􏶿 "string")
]


Expand Down
Loading

0 comments on commit 1a52cd8

Please sign in to comment.