** -*- koshu -*-
ascii-table : range @code -from 0 -to 127
| add @char ( char @code )
| pick @code @char
** -*- koshu -*-
**
** 使用例
** koshu ascii.k group.k
**
|== GROUP
: ascii-table -code /n -char /c
| add /g ( char-group-1 /c )
| nest /n /c -to /nc
| for /nc ( chunk /0 /1 /2 /3 -order /n )
--forward /g
--order
--table
Command koshu ascii.k group.k
produces:
** -*- koshu -*-
**
** INPUT
** ascii.k
** group.k
**
** OUTPUT
** <stdout>
**
|-- GROUP /g "letter" /nc {= /0 /1 /2 /3 [ {= /n /c [ 65 | "A" ] [ 66 | "B" ] [ 67 | "C" ] [ 68 | "D" ] [ 69 | "E" ] [
70 | "F" ] [ 71 | "G" ] [ 72 | "H" ] [ 73 | "I" ] [ 74 | "J" ] [ 75 | "K" ] [ 76 | "L" ] [ 77 | "M" ] =} | {= /n /c
[ 78 | "N" ] [ 79 | "O" ] [ 80 | "P" ] [ 81 | "Q" ] [ 82 | "R" ] [ 83 | "S" ] [ 84 | "T" ] [ 85 | "U" ] [ 86 | "V" ]
[ 87 | "W" ] [ 88 | "X" ] [ 89 | "Y" ] [ 90 | "Z" ] =} | {= /n /c [ 97 | "a" ] [ 98 | "b" ] [ 99 | "c" ] [ 100 | "d"
] [ 101 | "e" ] [ 102 | "f" ] [ 103 | "g" ] [ 104 | "h" ] [ 105 | "i" ] [ 106 | "j" ] [ 107 | "k" ] [ 108 | "l" ] [
109 | "m" ] =} | {= /n /c [ 110 | "n" ] [ 111 | "o" ] [ 112 | "p" ] [ 113 | "q" ] [ 114 | "r" ] [ 115 | "s" ] [ 116
| "t" ] [ 117 | "u" ] [ 118 | "v" ] [ 119 | "w" ] [ 120 | "x" ] [ 121 | "y" ] [ 122 | "z" ] =} ] =}
|-- GROUP /g "number" /nc {= /0 /1 /2 /3 [ {= /n /c [ 48 | "0" ] [ 49 | "1" ] [ 50 | "2" ] =} | {= /n /c [ 51 | "3" ]
[ 52 | "4" ] [ 53 | "5" ] =} | {= /n /c [ 54 | "6" ] [ 55 | "7" ] [ 56 | "8" ] =} | {= /n /c [ 57 | "9" ] =} ] =}
|-- GROUP /g "other" /nc {= /0 /1 /2 /3 [ {= /n /c [ 0 | <c0> ] [ 1 | <c1> ] [ 2 | <c2> ] [ 3 | <c3> ] [ 4 | <c4> ] [
5 | <c5> ] [ 6 | <c6> ] [ 7 | <c7> ] [ 8 | <c8> ] =} | {= /n /c [ 9 | <tab> ] [ 10 | <lf> ] [ 11 | <c11> ] [ 12 |
<c12> ] [ 13 | <cr> ] [ 14 | <c14> ] [ 15 | <c15> ] [ 16 | <c16> ] [ 17 | <c17> ] =} | {= /n /c [ 18 | <c18> ] [ 19
| <c19> ] [ 20 | <c20> ] [ 21 | <c21> ] [ 22 | <c22> ] [ 23 | <c23> ] [ 24 | <c24> ] [ 25 | <c25> ] [ 26 | <c26> ]
=} | {= /n /c [ 27 | <c27> ] [ 28 | <c28> ] [ 29 | <c29> ] [ 30 | <c30> ] [ 31 | <c31> ] [ 127 | <c127> ] =} ] =}
|-- GROUP /g "punct" /nc {= /0 /1 /2 /3 [ {= /n /c [ 33 | "!" ] [ 34 | <qq> ] [ 35 | "#" ] [ 37 | "%" ] [ 38 | "&" ] [
39 | "'" ] =} | {= /n /c [ 40 | "(" ] [ 41 | ")" ] [ 42 | "*" ] [ 44 | "," ] [ 45 | "-" ] [ 46 | "." ] =} | {= /n /c
[ 47 | "/" ] [ 58 | ":" ] [ 59 | ";" ] [ 63 | "?" ] [ 64 | "@" ] [ 91 | "[" ] =} | {= /n /c [ 92 | "\" ] [ 93 | "]"
] [ 95 | "_" ] [ 123 | "{" ] [ 125 | "}" ] =} ] =}
|-- GROUP /g "sep" /nc {= /0 /1 /2 /3 [ {= /n /c [ 32 | " " ] =} ] =}
|-- GROUP /g "symbol" /nc {= /0 /1 /2 /3 [ {= /n /c [ 36 | "$" ] [ 43 | "+" ] [ 60 | "<" ] =} | {= /n /c [ 61 | "=" ]
[ 62 | ">" ] [ 94 | "^" ] =} | {= /n /c [ 96 | "`" ] [ 124 | "|" ] [ 126 | "~" ] =} ] =}
*** 6 judges
=== note
TABLE : GROUP
/g /nc
---------- -----------------------------------------------------
"letter" /0 /1 /2 /3
----------- ------------ ------------- --------------
/n /c /n /c /n /c /n /c
---- ------ ---- ------- ----- ------- ----- --------
65 "A" 78 "N" 97 "a" 110 "n"
66 "B" 79 "O" 98 "b" 111 "o"
67 "C" 80 "P" 99 "c" 112 "p"
68 "D" 81 "Q" 100 "d" 113 "q"
69 "E" 82 "R" 101 "e" 114 "r"
70 "F" 83 "S" 102 "f" 115 "s"
71 "G" 84 "T" 103 "g" 116 "t"
72 "H" 85 "U" 104 "h" 117 "u"
73 "I" 86 "V" 105 "i" 118 "v"
74 "J" 87 "W" 106 "j" 119 "w"
75 "K" 88 "X" 107 "k" 120 "x"
76 "L" 89 "Y" 108 "l" 121 "y"
77 "M" 90 "Z" 109 "m" 122 "z"
"number" /0 /1 /2 /3
----------- ------------ ------------- --------------
/n /c /n /c /n /c /n /c
---- ------ ---- ------- ----- ------- ----- --------
48 "0" 51 "3" 54 "6" 57 "9"
49 "1" 52 "4" 55 "7"
50 "2" 53 "5" 56 "8"
"other" /0 /1 /2 /3
----------- ------------ ------------- --------------
/n /c /n /c /n /c /n /c
---- ------ ---- ------- ----- ------- ----- --------
0 <c0> 9 <tab> 18 <c18> 27 <c27>
1 <c1> 10 <lf> 19 <c19> 28 <c28>
2 <c2> 11 <c11> 20 <c20> 29 <c29>
3 <c3> 12 <c12> 21 <c21> 30 <c30>
4 <c4> 13 <cr> 22 <c22> 31 <c31>
5 <c5> 14 <c14> 23 <c23> 127 <c127>
6 <c6> 15 <c15> 24 <c24>
7 <c7> 16 <c16> 25 <c25>
8 <c8> 17 <c17> 26 <c26>
"punct" /0 /1 /2 /3
----------- ------------ ------------- --------------
/n /c /n /c /n /c /n /c
---- ------ ---- ------- ----- ------- ----- --------
33 "!" 40 "(" 47 "/" 92 "\"
34 <qq> 41 ")" 58 ":" 93 "]"
35 "#" 42 "*" 59 ";" 95 "_"
37 "%" 44 "," 63 "?" 123 "{"
38 "&" 45 "-" 64 "@" 125 "}"
39 "'" 46 "." 91 "["
"sep" /0 /1 /2 /3
----------- -- -- --
/n /c
---- ------
32 " "
"symbol" /0 /1 /2 /3
----------- ------------ ------------- --
/n /c /n /c /n /c
---- ------ ---- ------- ----- -------
36 "$" 61 "=" 96 "`"
43 "+" 62 ">" 124 "|"
60 "<" 94 "^" 126 "~"
=== rel
**
** SUMMARY
** 6 judges on GROUP
** 6 judges in total
**
** -*- koshu -*-
**
** 使用例
** koshu ascii.k table.k
**
|== TABLE
: ascii-table -code /n -char /c
| chunk /0 /1 /2 /3 /4 /5 /6 /7 -order /n
--order
--table
Command koshu ascii.k table.k
produces:
** -*- koshu -*-
**
** INPUT
** ascii.k
** table.k
**
** OUTPUT
** <stdout>
**
|-- TABLE /0 {= /n /c [ 0 | <c0> ] [ 1 | <c1> ] [ 2 | <c2> ] [ 3 | <c3> ] [ 4 | <c4> ] [ 5 | <c5> ] [ 6 | <c6> ] [ 7 |
<c7> ] [ 8 | <c8> ] [ 9 | <tab> ] [ 10 | <lf> ] [ 11 | <c11> ] [ 12 | <c12> ] [ 13 | <cr> ] [ 14 | <c14> ] [ 15 |
<c15> ] =} /1 {= /n /c [ 16 | <c16> ] [ 17 | <c17> ] [ 18 | <c18> ] [ 19 | <c19> ] [ 20 | <c20> ] [ 21 | <c21> ] [
22 | <c22> ] [ 23 | <c23> ] [ 24 | <c24> ] [ 25 | <c25> ] [ 26 | <c26> ] [ 27 | <c27> ] [ 28 | <c28> ] [ 29 | <c29>
] [ 30 | <c30> ] [ 31 | <c31> ] =} /2 {= /n /c [ 32 | " " ] [ 33 | "!" ] [ 34 | <qq> ] [ 35 | "#" ] [ 36 | "$" ] [
37 | "%" ] [ 38 | "&" ] [ 39 | "'" ] [ 40 | "(" ] [ 41 | ")" ] [ 42 | "*" ] [ 43 | "+" ] [ 44 | "," ] [ 45 | "-" ] [
46 | "." ] [ 47 | "/" ] =} /3 {= /n /c [ 48 | "0" ] [ 49 | "1" ] [ 50 | "2" ] [ 51 | "3" ] [ 52 | "4" ] [ 53 | "5"
] [ 54 | "6" ] [ 55 | "7" ] [ 56 | "8" ] [ 57 | "9" ] [ 58 | ":" ] [ 59 | ";" ] [ 60 | "<" ] [ 61 | "=" ] [ 62 | ">"
] [ 63 | "?" ] =} /4 {= /n /c [ 64 | "@" ] [ 65 | "A" ] [ 66 | "B" ] [ 67 | "C" ] [ 68 | "D" ] [ 69 | "E" ] [ 70 |
"F" ] [ 71 | "G" ] [ 72 | "H" ] [ 73 | "I" ] [ 74 | "J" ] [ 75 | "K" ] [ 76 | "L" ] [ 77 | "M" ] [ 78 | "N" ] [ 79 |
"O" ] =} /5 {= /n /c [ 80 | "P" ] [ 81 | "Q" ] [ 82 | "R" ] [ 83 | "S" ] [ 84 | "T" ] [ 85 | "U" ] [ 86 | "V" ] [
87 | "W" ] [ 88 | "X" ] [ 89 | "Y" ] [ 90 | "Z" ] [ 91 | "[" ] [ 92 | "\" ] [ 93 | "]" ] [ 94 | "^" ] [ 95 | "_" ]
=} /6 {= /n /c [ 96 | "`" ] [ 97 | "a" ] [ 98 | "b" ] [ 99 | "c" ] [ 100 | "d" ] [ 101 | "e" ] [ 102 | "f" ] [ 103
| "g" ] [ 104 | "h" ] [ 105 | "i" ] [ 106 | "j" ] [ 107 | "k" ] [ 108 | "l" ] [ 109 | "m" ] [ 110 | "n" ] [ 111 |
"o" ] =} /7 {= /n /c [ 112 | "p" ] [ 113 | "q" ] [ 114 | "r" ] [ 115 | "s" ] [ 116 | "t" ] [ 117 | "u" ] [ 118 |
"v" ] [ 119 | "w" ] [ 120 | "x" ] [ 121 | "y" ] [ 122 | "z" ] [ 123 | "{" ] [ 124 | "|" ] [ 125 | "}" ] [ 126 | "~"
] [ 127 | <c127> ] =}
*** 1 judge
=== note
TABLE : TABLE
/0 /1 /2 /3 /4 /5 /6 /7
------------ ------------ ----------- ---------- ---------- ---------- ----------- --------------
/n /c /n /c /n /c /n /c /n /c /n /c /n /c /n /c
---- ------- ---- ------- ---- ------ ---- ----- ---- ----- ---- ----- ----- ----- ----- --------
0 <c0> 16 <c16> 32 " " 48 "0" 64 "@" 80 "P" 96 "`" 112 "p"
1 <c1> 17 <c17> 33 "!" 49 "1" 65 "A" 81 "Q" 97 "a" 113 "q"
2 <c2> 18 <c18> 34 <qq> 50 "2" 66 "B" 82 "R" 98 "b" 114 "r"
3 <c3> 19 <c19> 35 "#" 51 "3" 67 "C" 83 "S" 99 "c" 115 "s"
4 <c4> 20 <c20> 36 "$" 52 "4" 68 "D" 84 "T" 100 "d" 116 "t"
5 <c5> 21 <c21> 37 "%" 53 "5" 69 "E" 85 "U" 101 "e" 117 "u"
6 <c6> 22 <c22> 38 "&" 54 "6" 70 "F" 86 "V" 102 "f" 118 "v"
7 <c7> 23 <c23> 39 "'" 55 "7" 71 "G" 87 "W" 103 "g" 119 "w"
8 <c8> 24 <c24> 40 "(" 56 "8" 72 "H" 88 "X" 104 "h" 120 "x"
9 <tab> 25 <c25> 41 ")" 57 "9" 73 "I" 89 "Y" 105 "i" 121 "y"
10 <lf> 26 <c26> 42 "*" 58 ":" 74 "J" 90 "Z" 106 "j" 122 "z"
11 <c11> 27 <c27> 43 "+" 59 ";" 75 "K" 91 "[" 107 "k" 123 "{"
12 <c12> 28 <c28> 44 "," 60 "<" 76 "L" 92 "\" 108 "l" 124 "|"
13 <cr> 29 <c29> 45 "-" 61 "=" 77 "M" 93 "]" 109 "m" 125 "}"
14 <c14> 30 <c30> 46 "." 62 ">" 78 "N" 94 "^" 110 "n" 126 "~"
15 <c15> 31 <c31> 47 "/" 63 "?" 79 "O" 95 "_" 111 "o" 127 <c127>
=== rel
**
** SUMMARY
** 1 judge on TABLE
** 1 judge in total
**
This document is produced by the command:
koshu-inout.sh -s -g koshu ascii.k