3 title/'4k: Atom Printing'
12Literal rendering engine
14A door that contains arms that operate on the sample coin `lot`.
34 { lot/{$many {$~ $ta @t} {$~ $ud @ud} $~}
35 <10.cfg 4.jjn {rep/"" <402.arm 110.jyx 1.ztu $151>}>
40------------------------------------------------------------------------
44Prepend & render as tape
46Renders a coin `lot` as a tape prepended to the sample tape `rom`.
59 ++ rear |=(rom/tape =>(.(rex rom) rend))
65 > (~(rear co %$ %ux 200) "--ha")
69------------------------------------------------------------------------
75Renders a coin `lot` as a span.
86 ++ rent `@ta`(rap 3 rend)
92 > ~(rent co %$ %ux 200)
95 > `@t`~(rent co %$ %ux 200)
98------------------------------------------------------------------------
104Renders a coin `lot` as a tape.
118 ['~' '0' ((v-co 1) (jam p.lot))]
124 ['_' (weld (trip (wack rent(lot i.p.lot))) $(p.lot t.p.lot))]
125 =+ [yed=(end 3 1 p.p.lot) hay=(cut 3 [1 1] p.p.lot)]
127 ?+ yed (z-co q.p.lot)
128 $c ['~' '-' (weld (rip 3 (wood (tuft q.p.lot))) rep)]
130 ?+ hay (z-co q.p.lot)
132 =+ yod=(yore q.p.lot)
133 => ^+(. .(rep ?~(f.t.yod rep ['.' (s-co f.t.yod)])))
137 ?: &(=(~ f.t.yod) =(0 h.t.yod) =(0 m.t.yod) =(0 s.t.yod))
139 => .(rep ['.' (y-co s.t.yod)])
140 => .(rep ['.' (y-co m.t.yod)])
141 ['.' '.' (y-co h.t.yod)]
143 => .(rep ['.' (a-co d.t.yod)])
144 => .(rep ['.' (a-co m.yod)])
145 => .(rep ?:(a.yod rep ['-' rep]))
149 =+ yug=(yell q.p.lot)
150 => ^+(. .(rep ?~(f.yug rep ['.' (s-co f.yug)])))
152 ?: &(=(0 d.yug) =(0 m.yug) =(0 h.yug) =(0 s.yug))
154 => ^+(. ?:(=(0 s.yug) . .(rep ['.' 's' (a-co s.yug)])))
155 => ^+(. ?:(=(0 m.yug) . .(rep ['.' 'm' (a-co m.yug)])))
156 => ^+(. ?:(=(0 h.yug) . .(rep ['.' 'h' (a-co h.yug)])))
157 => ^+(. ?:(=(0 d.yug) . .(rep ['.' 'd' (a-co d.yug)])))
164 ?:(=(| q.p.lot) ['.' 'n' rep] (z-co q.p.lot))
168 ?+ hay (z-co q.p.lot)
169 $f ((ro-co [3 10 4] |=(a/@ ~(d ne a))) q.p.lot)
170 $s ((ro-co [4 16 8] |=(a/@ ~(x ne a))) q.p.lot)
174 =+ dyx=(met 3 q.p.lot)
177 (weld (trip (tod:po q.p.lot)) rep)
180 (trip (tos:po (end 3 1 q.p.lot)))
181 (trip (tod:po (rsh 3 1 q.p.lot)))
184 =+ [dyz=(met 5 q.p.lot) fin=| dub=&]
192 q.p.lot (rsh 5 1 q.p.lot)
194 =+ syb=(wren:un (end 5 1 q.p.lot))
195 =+ cog=~(zig mu [(rsh 4 1 syb) (end 4 1 syb)])
197 (trip (tos:po (end 3 1 p.cog)))
198 (trip (tod:po (rsh 3 1 p.cog)))
200 (trip (tos:po (end 3 1 q.cog)))
201 (trip (tod:po (rsh 3 1 q.cog)))
202 `tape`?.(fin ~ ['-' ?.(dub ~ ['-' ~])])
208 ?+ hay (z-co q.p.lot)
209 $d ['.' '~' (r-co (rlyd q.p.lot))]
210 $h ['.' '~' '~' (r-co (rlyh q.p.lot))]
211 $q ['.' '~' '~' '~' (r-co (rlyq q.p.lot))]
212 $s ['.' (r-co (rlys q.p.lot))]
217 %+ welp ['0' 'c' (reap (pad:fa q.p.lot) '1')]
218 (c-co (enc:fa q.p.lot))
219 =- (weld p.gam ?:(=(0 q.p.lot) `tape`['0' ~] q.gam))
220 ^= gam ^- {p/tape q/tape}
221 ?+ hay [~ ((ox-co [10 3] |=(a/@ ~(d ne a))) q.p.lot)]
222 $b [['0' 'b' ~] ((ox-co [2 4] |=(a/@ ~(d ne a))) q.p.lot)]
223 $i [['0' 'i' ~] ((d-co 1) q.p.lot)]
224 $x [['0' 'x' ~] ((ox-co [16 4] |=(a/@ ~(x ne a))) q.p.lot)]
225 $v [['0' 'v' ~] ((ox-co [32 5] |=(a/@ ~(x ne a))) q.p.lot)]
226 $w [['0' 'w' ~] ((ox-co [64 5] |=(a/@ ~(w ne a))) q.p.lot)]
231 ?:((syn:si q.p.lot) "--" "-")
232 $(yed 'u', q.p.lot (abs:si q.p.lot))
236 ?: =('s' (cut 3 [2 1] p.p.lot))
237 (weld (rip 3 q.p.lot) rep)
238 ['~' '.' (weld (rip 3 q.p.lot) rep)]
239 ['~' '~' (weld (rip 3 (wood q.p.lot)) rep)]
247 > ~(rend co ~ %ux 200)
250 > ~(rend co %many ~[[%$ ux+200] [%$ p+40]])
253 > ~(rend co ~ %p 32.819)
256 > ~(rend co ~ %ux 18)
259 > ~(rend co [~ p=[p=%if q=0x7f00.0001]])
265 > ~(rend co %many ~[[~ %ud 20] [~ %uw 133] [~ %tas 'sam']])
268 > ~(rend co %blob [1 1])
284Parse alphabetic characters, both upper and lowercase.
289 ++ alf ;~(pose low hig) :: alphabetic
301 > (scan "AaBbCc" (star alf))
309Alphanumeric characters
311Parse alphanumeric characters - both alphabetic characters and numbers.
316 ++ aln ;~(pose low hig nud) :: alphanumeric
325 > (scan "alf42" (star aln))
328 > (scan "0123456789abcdef" (star aln))
338Parse alphanumeric strings and hep, "-".
343 ++ alp ;~(pose low hig nud hep) :: alphanumeric and -
355 > (scan "123abc-" (star alp))
366Parse the hep and lus axis syntax.
371 ++ bet ;~(pose (cold 2 hep) (cold 3 lus)) :: axis syntax - +
390Parse a tape of binary (0s and 1s) and produce its atomic representation.
395 ++ bin (bass 2 (most gon but)) :: binary to atom
410 > (scan "100000001111" bin)
420Parse a single binary digit.
425 ++ but (cook |=(a=@ (sub a '0')) (shim '0' '1')) :: binary digit
439 > (scan "01" (star but))
449Parse a single octal digit.
454 ++ cit (cook |=(a=@ (sub a '0')) (shim '0' '7')) :: octal digit
468 > (scan "60" (star cit))
478Parse a decimal number to an atom.
483 ++ dem (bass 10 (most gon dit)) :: decimal to atom
493 > (scan "150000000" dem)
505Parse a single decimal digit.
510 ++ dit (cook |=(a=@ (sub a '0')) (shim '0' '9')) :: decimal digit
518 > (scan "42" (star dit))
520 > (scan "26000" (star dit))
530Dot followed by an optional gap, used with numbers.
535 ++ dog ;~(plug dot gay) ::
545 > (scan "a. " ;~(pfix alf dog))
555Phonetic base phrase separator
560 ++ doh ;~(plug ;~(plug hep hep) gay) ::
566 /> ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
567 ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
568 /> ~nopfel-botduc-nilnev-dolfyn--
569 haspub-natlun-lodmur-holtyd
570 ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
583Parse phep, `--`, to null, `~`.
588 ++ dun (cold ~ ;~(plug hep hep)) :: -- (phep) to ~
597 [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=""]]]]
607Parse stet, `==`, to null `~`.
612 ++ duz (cold ~ ;~(plug tis tis)) :: == (stet) to ~
620 > (duz [[1 1] "== |=..."])
621 [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=" |=..."]]]]
631Whitespace component, either newline or space.
636 ++ gah (mask [`@`10 ' ' ~]) :: newline or ace
642 /> ^- * :: show spaces
648 [32 32 32 45 10 32 45 10 32 32 45 0]
653 [32 32 32 10 32 10 32 32 0]
655 %- scan :_ (star gah)
659 ~[32 32 32 10 32 10 32 32]
673 ++ gap (cold ~ ;~(plug gaq (star ;~(pose vul gah)))) :: plural whitespace
682Two spaces, a newline, or comment.
687 ++ gaq ;~ pose :: end of line
689 ;~(plug gah ;~(pose gah vul))
706 ++ gaw (cold ~ (star ;~(pose vul gah))) :: classic white
720 ++ gay ;~(pose gap (easy ~)) ::
728Parse long numbers - Numbers which wrap around the shell with the line
733 ++ gon ;~(pose ;~(plug bas gay fas) (easy ~)) :: long numbers \ /
742 > (gon [[1 1] "\\/"])
743 [p=[p=1 q=3] q=[~ u=[p=[~~~5c. ~ ~~~2f.] q=[p=[p=1 q=3] q=""]]]]
750Axis syntax `<` or `>`
752Parse the axis gal and gar axis syntax.
757 ++ gul ;~(pose (cold 2 gal) (cold 3 gar)) :: axis syntax < >
776Parse any hexadecimal number to an atom.
781 ++ hex (bass 16 (most gon hit)) :: hex to atom
797 > (scan "1EE7F7" hex)
799 > `@ux`(scan "1EE7F7" hex)
808Parse a single uppercase letter.
813 ++ hig (shim 'A' 'Z') :: uppercase
822 > `cord`(scan "G" hig)
825 > (scan "ABCDEFGHIJKLMNOPQRSTUVWXYZ" (star hig))
826 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
829 [p=[p=1 q=2] q=[~ [p=~~~47. q=[p=[p=1 q=2] q=""]]]]
838Parse a single hexadecimal digit.
843 ++ hit ;~ pose :: hex digits
845 (cook |=(a=char (sub a 87)) (shim 'a' 'f'))
846 (cook |=(a=char (sub a 55)) (shim 'A' 'F'))
858 [p=[p=1 q=2] q=[~ [p=10 q=[p=[p=1 q=2] q=""]]]]
859 > (scan "2A" (star hit))
868Apply `++rule` to indented block starting at current column number, omitting
869the leading whitespace.
882 ++ inde |* sef/rule :: indentation block
884 =+ [har tap]=[p q]:+<
885 =+ lev=(fil 3 (dec q.har) ' ')
887 =+ =- roq=((star ;~(pose prn ;~(sfix eol (jest lev)) -)) har tap)
888 ;~(simu ;~(plug eol eol) eol)
890 =+ vex=(sef har(q 1) p.u.q.roq)
891 =+ fur=p.vex(q (add (dec q.har) q.p.vex))
895 &4.vex(q.p (add (dec q.har) q.p.&4.vex))
898 ?. =(10 -.res) [-.res $(res +.res)]
899 (welp [`@t`10 (trip lev)] $(res +.res))
906 > (scan "abc" (iny (star ;~(pose prn (just `@`10)))))
908 > (scan "abc" (star ;~(pose prn (just `@`10))))
910 > (scan " abc\0ade" ;~(pfix ace ace (star ;~(pose prn (just `@`10)))))
913 > (scan " abc\0ade" ;~(pfix ace ace (iny (star ;~(pose prn (just `@`10))))))
916 > (scan " abc\0a de" ;~(pfix ace ace (iny (star ;~(pose prn (just `@`10))))))
927Parse a single lowercase letter.
932 ++ low (shim 'a' 'z') :: lowercase
940 > `cord`(scan "g" low)
942 > (scan "abcdefghijklmnopqrstuvwxyz" (star low))
943 "abcdefghijklmnopqrstuvwxyz"
945 [p=[p=1 q=2] q=[~ [p=~~g q=[p=[p=1 q=2] q=""]]]]
959 ++ mes %+ cook :: hexbyte
960 |=({a/@ b/@} (add (mul 16 a) b))
970 [p=[p=1 q=3] q=[~ u=[p=42 q=[p=[p=1 q=3] q=""]]]]
981Parse Letters and `-`.
986 ++ nix (boss 256 (star ;~(pose aln cab))) ::
995 > `@t`(scan "as_me" nix)
1006Parse a numeric character - A number.
1011 ++ nud (shim '0' '9') :: numeric
1022 [p=[p=1 q=2] q=[~ [p=~~1 q=[p=[p=1 q=2] q=""]]]]
1023 > (scan "0123456789" (star nud))
1032Parse any printable character.
1037 ++ prn ;~(less (just `@`127) (shim 32 256))
1058Parse an individual character to its cord atom representation.
1063 ++ qit ;~ pose :: chars in a cord
1064 ;~(less bas soq prn)
1065 ;~(pfix bas ;~(pose bas soq mes)) :: escape chars
1074 > `@t`(scan "%" qit)
1084 > `@ux`(scan "\\0a" qit)
1086 > (scan "cord" (star qit))
1096Parse an individual character to its cord atom representation.
1101 ++ qit ;~ pose :: chars in a cord
1102 ;~(less bas soq prn)
1103 ;~(pfix bas ;~(pose bas soq mes)) :: escape chars
1112 > `@t`(scan "%" qit)
1122 > `@ux`(scan "\\0a" qit)
1124 > (scan "cord" (star qit))
1135Parse single-soq cord with `\{gap}/` anywhere in the middle, or triple-single
1136quote (aka triple-soq) cord, between which must be in an indented block.
1141 ++ qut ;~ pose :: cord
1143 (ifix [soq soq] (boss 256 (more gon qit)))
1147 ;~(pose ;~(plug (plus ace) vul) (just '\0a'))
1149 ;~(plug (just '\0a') soqs)
1150 (boss 256 (star qat))
1158 > (scan "'cord'" qut)
1165 Heredoc isn't prohibited from containing quotes
1167 'Heredoc isn't prohibited from containing quotes'
1176Parse a triple-single quote, used for multiline strings.
1181 ++ soz ;~(plug soq soq soq) :: delimiting '''
1188 [~~~27. ~~~27. ~~~27.]
1200A term: a letter(lowercase), followed by letters, numbers, or `-`.
1207 |=(a=tape (rap 3 ^-((list ,@) a)))
1208 ;~(plug low (star ;~(pose nud low hep)))
1215 > (scan "sam-2" sym)
1217 > `@t`(scan "sam-2" sym)
1234 ++ ven ;~ (comp |=({a/@ b/@} (peg a b))) :: +>- axis syntax
1239 =+ vex=?:(hom (bet tub) (gul tub))
1242 =+ wag=$(p.tub p.vex, hom !hom, tub q.u.q.vex)
1244 [p.wag [~ (peg p.u.q.vex p.u.q.wag) q.u.q.wag]]
1251 ~zod/arvo=/hoon/hoon> (scan "->+" ven)
1254 ~zod/arvo=/hoon/hoon> `@ub`(scan "->+" ven)
1257 ~zod/arvo=/hoon/hoon> (peg (scan "->" ven) (scan "+" ven))
1260 ~zod/arvo=/hoon/hoon> ->+:[[1 2 [3 4]] 5]
1270Parse a standard base64 digit.
1275 ++ vit :: base64 digit
1277 (cook |=(a/@ (sub a 65)) (shim 'A' 'Z'))
1278 (cook |=(a/@ (sub a 71)) (shim 'a' 'z'))
1279 (cook |=(a/@ (add a 4)) (shim '0' '9'))
1280 (cold 62 (just '-'))
1281 (cold 63 (just '+'))
1288 ~zod/arvo=/hoon/hoon> (scan "C" vit)
1290 ~zod/arvo=/hoon/hoon> (scan "c" vit)
1292 ~zod/arvo=/hoon/hoon> (scan "2" vit)
1294 ~zod/arvo=/hoon/hoon> (scan "-" vit)
1306 ++ vul %+ cold ~ :: comments
1313Parse comments and produce a null. Note that a comment must be ended
1314with a newline character.
1319 > (scan "::this is a comment \0a" vul)
1321 > (scan "::this is a comment " vul)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list