5.2 双 and
Originates from Pairs and Lists and Extends to .
5.2.1 Naming Rules
Character | Connotation | Elucidation | Example |
resembles | Has the similar function process as it resembling and the type of output is same as accordingly. | ||
resembles | Has the similar function process as it resembling and the type of output is same as () accordingly. | ||
general subset or cousion | Returns a new list with elements produced from the input list.(Implies the input data and output data are the same type.) | ||
serial subset | Returns a new list with elements serially produced from the input list.(Implies the input data and output data are the same type.) | ||
serial subset of lists | Returns a new list with elements serially produced from the input lists.(Implies the multiple input data and output data are the same type.) | ||
broken subset | Returns a new list with removing some elements from the input list. | ||
broken subset of lists | Returns a new list with removing some elements from the input lists.(Implies the multiple input data and output data are the same type.) | ||
split input list to values | Implies the type of output data is values(並). | ||
split input lists to values | Implies input data is lists and the type of output data is values(並). | ||
same as /入 | Implies the type of input data is function. | ||
product data | Manufactures data and product new one, implies the type of output data is not same as input. | ||
Phrase | - | - | - |
split data to values | |||
Punctuation | - | - | - |
strengthen | Strengthen the process, thus the data of output may become longer, and the type may be changed accordingly. | ||
soften | Soften the process, thus the output data shorter. | ||
list as input | Implies the type of input data is list. | ||
extend prefix | Suffix of / can be considered as an extending explanation of its prefix. | ||
boolean as output | Implies the type of output data is boolean. | ||
Hybrid | - | - | - |
function as input | Implies the type of input data is function. |
5.2.2 双, 㐅, , , 阴, 阳
Abstractly, we can pair two data together. Integrally, it is called 双. Separately, the position where set the first data is call 阳, the second is call 阴.
Further more, if we put another 双 to 阴 position of the former 双, we get a linked data. Likewise, the linked data can be extended as long as you want. By this way, if we leave 阴 of the ending 双 to be empty(㐅), we get a data called ; if not, we call it .
> (双 1 2) '(1 . 2)
> (双 1 (双 2 (双 3 (双 4 㐅)))) '(1 2 3 4)
> ( 1 2 3 4) '(1 2 3 4)
> (双 1 (双 2 (双 3 4))) '(1 2 3 . 4)
> ( 1 2 3 4) '(1 2 3 . 4)
> ( 1 2 3 '(4)) '(1 2 3 4)
> (阳 '(1 . 2)) 1
> (阴 '(1 . 2)) 2
> (阳 '(1 2 3 4)) 1
> (阴 '(1 2 3 4)) '(2 3 4)
5.2.3 阴阳+-
阳+/阴+/阳-/阴-: For the case of functions starting with 阴 or 阳 and following with + or -, + stands for 阳 and - stands for 阴.
For example, (阴+-- lst) is short for (阴 (阴 (阳 (阴 lst)))).
5.2.4 ,
/: 毌: simplified from 贯, which means append, going through a few objects and connect them together.
> ( 1 2 3 4) '(1 2 3 4)
> ( '(1) '(2) '(3) '(4)) '(1 2 3 4)
> ( '(1) '(2 3 4) '(5 6) '(7)) '(1 2 3 4 5 6 7)
> ( '(a b) 'c) '(a b . c)
> ( '(a b) '(c . d)) '(a b c . d)
> ( '() 'a) 'a
> ( 'a) 'a
> ( 1 2 3 4) '(1 2 3 . 4)
> ( '(1) '(2) '(3) '(4)) '(1 2 3 . 4)
> ( '(1) '(2 3 4) '(5 6) '(7)) '(1 2 3 4 5 6 . 7)
> ( 1 2 3 '(4)) '(1 2 3 4)
> ( '(1) '(2) '(3) '((4))) '(1 2 3 4)
> ( '(1) '(2 22) '(3 33) '((4 44))) '(1 2 22 3 33 4 44)
> ( '(1) '(2 22) '((3 33)) '((4 44))) '(1 2 22 (3 33) 4 44)
> ( '(a b) '(c)) '(a b . c)
> ( '(a b) '((c . d))) '(a b c . d)
> ( '() '(a)) 'a
> ( '(a)) 'a
5.2.5 攸
🐘 𰁦 𢪛
5.2.6 , *
> ( 10) '(0 1 2 3 4 5 6 7 8 9)
> ( 10 20) '(10 11 12 13 14 15 16 17 18 19)
> ( 10 20 2) '(10 12 14 16 18)
> (* 10 20) '(10 11 12 13 14 15 16 17 18 19 20)
> (* 10 20 2) '(10 12 14 16 18 20)
5.2.7 ,
5.2.8 弔, 弓,弓*, , *
5.2.9 , , , , , , , , ,
5.2.10 末,
5.2.11 巨
🐘
> (巨 '(a b c d e 3 f g)) 8
5.2.12 ,𨚞, ,, ,, /入,𨚞/入, ?
🐘
> ( '(a b c d e f g) 2) '(a b)
> (𨚞 '(a b c d e f g) 2) '(f g)
> ( '(a b c d e f g) 2) '(c d e f g)
> ( '(a b c d e f g) 2) '(a b c d e)
> ( '(a b c d e f g) 2)
'(a b)
'(c d e f g)
> ( '(a b c d e f g) 2)
'(a b c d e)
'(f g)
> (/入 '(8 4 a b 1 c d 2 e f g 3 5 9) 米?) '(8 4)
> (𨚞/入 '(8 4 a b 1 c d 2 e f g 3 5 9) 米?) '(3 5 9)
> (? '(a b) '(a b c d e f g)) #t
> (? '(a b z) '(a b c d e f g)) #f
5.2.13 左, 左, 左
//: 同.
5.2.14 𰂋,偏,,重、𠝤
🐘 偅
> (𰂋 '(a b c d) '和) '(a 和 b 和 c 和 d)
> (偏 '((a b) (c d) (e f))) '(a b c d e f)
> ( '(a b c d e d c b a)) '(a d a c e c d b b)
> (重 '(a b c d e d c b a)) 'd
> (𠝤 '(a b c d e d c b a)) '(a b c d e)
5.2.15 、𠆯
> ( '(21 3 888 666 55 77 1000)) '(1000 77 55 666 888 3 21)
> (𠆯 '(21 3 888 666 55 77 1000) <) '(3 21 55 77 666 888 1000)
> (𠆯 '(21 3 888 666 55 77 1000) >) '(1000 888 666 77 55 21 3)
> (𠆯 '("cat" "dog" "chicken" "duck" "fox") <?) '("cat" "chicken" "dog" "duck" "fox")
> (𠆯 '("cat" "dog" "chicken" "duck" "fox") >?) '("fox" "duck" "dog" "chicken" "cat")
5.2.16 、、~、^,,,、,~、
> ( 'c '(a b c d e f)) '(c d e f)
> ( 'c '((a b) (c d) (e f))) '(c d)
> (~ 'c '(a b c d e c f)) '(a b d e c f)
> (^ '(c e) '(a b c d e c f)) '(a b d f)
> ( 米? '(a b 1 c d 3 e 9 f)) 1
> ( 米? '(a b 1 c d 3 e 9 f)) '(1 3 9)
> ( 米? '(a b 1 c d 3 e 9 f)) '(1 c d 3 e 9 f)
> ( 米? '((a b) (1 d) (j k) (8 f))) '(1 d)
> ( 米? '(a b 1 c d 3 e 9 f)) '(a b c d e f)
> (~ 米? '(a b 1 c d 3 e 9 f)) '(a b c d 3 e 9 f)
5.2.17 分,巨
5.2.18 ,, ,,,右
(右 PROC z ( a b c)) is simplified from: (PROC a (PROC b (PROC c z)))
> ( 行示 ( 2 4 6 8))
2
4
6
8
> ( '(1 2 3 4)) '(2 3 4 5)
> ( + '(1 2 3 4) '(100 200 300 400)) '(101 202 303 404)
> ( ? '(1 2 -3 4)) #f
> ( + '(1 2 3 4) '(100 200 300 400)) 404
> ( ? '(1 2 -3 4)) #f
> ( + '(1 2 3 4) '(100 200 300 400)) 101
> ( + 0 '(1 2 -3 4)) 4
> ( 双 '() '(1 2 -3 4)) '(4 -3 2 1)
> (右 双 '() '(1 2 -3 4)) '(1 2 -3 4)
5.2.19 ,, 、
> ( (入 (x) (并 (? x) ( x))) '(-2 -1 0 1 2)) '(2 3)
> ( 化 '(#(1) #(2 3) #(4))) '(1 2 3 4)
> ( char->integer '(#\a #\y #\b #\k #\c #\j #\d)) #\y
> ( char->integer '(#\a #\y #\b #\k #\c #\j #\d)) #\a
> ( 阳 '((3 pears) (1 banana) (2 apples))) '(3 pears)
> ( 阳 '((3 pears) (1 banana) (2 apples))) '(1 banana)
5.2.20 /组合、/排列组合,/笛卡尔积,/分组
5.2.21 ming/racket/base
(require ming/racket/base) | package: ming |
word
word
word
word
word
word
word
word
word
word
: 弓 + = build-list
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
5.2.22 ming/racket/list
(require ming/racket/list) | package: ming |
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
word
攸/入 : 攸 + / + 入 = list-update
word
word
: 弓 + 入 = index-where
word
弓* : 弓 + * = indexes-of
word
* : + * = indexes-where
word
word
𨚞 : 右 + 阝 = take-right
word
word
: 右 + 刂 = drop-right
word
word
𨚞/入 : 𨚞 + / + 入 = takef-right
word
word
/入 : + / + 入 = dropf-right
word
word
: 右 + 分 = split-at-right
word
word
/入 : + / + 入 = splitf-at-right
word
? : + ? = list-prefix?
word
左 : 左 + 同 + = take-common-prefix
word
左 : 左 + 同 + = drop-common-prefix
word
左 : 左 + 同 + = split-common-prefix
word
word
𰂋 : 亻 + 间 = add-between
word
word
word
重 : 重 = check-duplicates
word
𠝤 : 重 + 刂 = remove-duplicates
word
: + 刂 = filter-not
word
word
word
: + = filter-map
word
: + = append-map
word
word
* : + * = inclusive-range
word
/组合 : + / + 组合 = combinations
word
/排列组合 : + / + 排列组合 = permutations
word
序列/组合 : 序列 + / + 组合 = in-combinations
word
序列/排列组合 : 序列 + / + 排列组合 = in-permutations
word
word
word
word
/笛卡尔积 : + / + 笛卡尔积 = cartesian-product
word