on master help sign in
Moved content into separate arm files.
a75a13fC. Guy Yarvin
docs/system/hoon/library/0.md−36
@@ -1,39 +1,3 @@
10 Kelvin Versioning
10 Kelvin Versioning
2===================
2===================
3
3
4−### `++hoon`
5−
6−Hoon version number Kelvin
7−
8−Traditional software versioning schema use fractions, and count up. Thus, they
9−can keep extending and revising their systems incrementally. This is generally
10−considered a good thing, and it generally is.
11−
12−In some cases, however, specifications needs to be permanently frozen.
13−This requirement is generally found in the context of standards. Some
14−standards are extensible or versionable, but some are not. ASCII, for
15−instance, is perma-frozen. So is IPv4 (its relationship to IPv6 is
16−little more than nominal - if they were really the same protocol, they'd
17−have the same ethertype). Moreover, many standards render themselves
18−incompatible in practice through excessive enthusiasm for extensibility.
19−They may not be perma-frozen, but they probably should be.
20−
21−As urbit is designed to be a standard, we devised a versioning scheme that will
22−allow it to eventually be frozen: Kelvin versioning. In Kelvin versioning,
23−releases count down by integer degrees Kelvin. At absolute zero, the system can
24−no longer be changed. At 1K, one more modification is possible. And so on. For
25−instance, Nock is at 5K. It might change, though it probably won't. Nouns
26−themselves are at 0K - it is impossible to imagine changing anything about
27−their three sentence definition.
28−
29−Source
30−------
31−
32− ++ hoon %164 :: version stub
33−
34−Examples
35−--------
36−
37− ~zod/try=> hoon
38− %163
39−
docs/system/hoon/library/1.md+58−2092
@@ -5,2237 +5,203 @@
5
5
6<div id="toc">
6<div id="toc">
7
7
8−### `++abel`
9−
10−Biblical names in hoon are primarily aliases for the compiler.
11−
12−Source
13−------
14−
15− ++ abel typo :: original sin: type
16−
17−Examples
18−--------
19−
20− ~zod/try=> *abel
21− %void
22−
23−------------------------------------------------------------------------
24−
25−### `++axis`
26−
27−Nock axis
28−
29−A Nock axis inside a [noun](). After the leading 1, in binary, a `1` signfies
30−right and `0` left.
31−
32−Source
33−------
34−
35− ++ axis ,@ :: tree address
36−
37−Examples
38−--------
39−
40− ~zod/try=> *axis
41− 0
42−
43− ~zod/try=> :: 0 is not actually a valid axis
44− ~zod/try=> [[4 5] 6 7]
45− [[4 5] 6 7]
46− ~zod/try=> `axis`0b110
47− 6
48−
49−-----------------------------------------------------------------------
50−
51−### `++base`
52−
53−Base type
54−
55−A base type that [noun]()s are built from. A `++base` is either a noun, cell, boolean or
56−null labelled with an [odor]().
57−
58−Source
59−------
60−
61− ++ base ?([%atom p=odor] %noun %cell %bean %null) :: axils, @ * ^ ? ~
62−
63−Examples
64−--------
65−
66− ~zod/try=> *base
67− %null
68−
69− ~zod/try=> (ream '=|(^ !!)')
70− [%tsbr p=[%axil p=%cell] q=[%zpzp ~]]
71− ~zod/try=> :: p.p is a ++base
72− ~zod/try=> (ream '=|(@t !!)')
73− [%tsbr p=[%axil p=[%atom p=~.t]] q=[%zpzp ~]]
74− ~zod/try=> (ream '=|(? !!)')
75− [%tsbr p=[%axil p=%bean] q=[%zpzp ~]]
76−
77−------------------------------------------------------------------------
78−
79−### `++bean`
80−
81−Boolean
82−
83−`0`, `&`, or `%.y` are true, and `1`, `|`, and `%.n` are false.
84−
85−Source
86−------
87−
88− ++ bean ,? :: 0=&=yes, 1=|=no
89−
90−Examples
91−--------
92−
93− ~zod/try=> *bean
94− %.y
95−
96− ~zod/try=> `bean`&
97− %.y
98− ~zod/try=> `bean`|
99− %.n
100−
101−------------------------------------------------------------------------
102−
103−### `++beer`
104−
105−Tape builder
106−
107−Used to build [tape]()s internally.
108−
109−Source
110−------
111−
112− ++ beer $|(@ [~ p=twig]) :: simple embed
113−
114−Examples
115−--------
116−
117− ~zod/try=> `beer`'as'
118− 29.537
119− ~zod/try=> `beer`[~ (ream 'lan')]
120− [~ p=[%cnzz p=~[%lan]]]
121−
122−------------------------------------------------------------------------
123−
124−### `++beet`
125−
126−XML interpolation cases
127−
128−Used internally.
129−
130−Source
131−------
132−
133− ++ beet $| @ :: advanced embed
134− $% [%a p=twig] :: take tape
135− [%b p=twig] :: take manx
136− [%c p=twig] :: take marl
137− [%d p=twig] :: take $+(marl marl)
138− [%e p=twig q=(list tuna)] :: element literal
139− == ::
140−
141−------------------------------------------------------------------------
142−
143−### `++bloq`
144−
145−Blocksize
146−
147−Atom representing a blocksize, by convention expressed as a power of 2.
148−
149−
150−Source
151−------
152−
153− ++ bloq ,@ :: blockclass
154−
155−Examples
156−--------
157−
158− ~zod/try=> :: ++met measures how many bloqs long an atom is
159− ~zod/try=> (met 3 256)
160− 2
161− ~zod/try=> :: 256 is 2 bloqs of 2^3
162−
163−------------------------------------------------------------------------
164−
165−### `++calf`
166−
167−Cyclical backreferences
168−
169−Encodes cyclical backreferences in types. Used in pretty printing.
170−
171−Source
172−------
173−
174− ++ calf ,[p=(map ,@ud wine) q=wine] ::
175−
176−Examples
177−--------
178−
179− ~zod/try=> `calf`[~ %atom %ta]
180− [p={} q=[%atom p=%ta]]
181−
182− ~zod/try=> `calf`~(dole ut p:!>(*^))
183− [p={} q=[%plot p=~[%noun %noun]]]
184−
185− ~zod/try=> `calf`~(dole ut p:!>($:|-(?(~ [* $]))))
186− [ p={[p=1 q=[%pick p=~[[%pear p=%n q=0] [%plot p=~[%noun [%stop p=1]]]]]]}
187− q=[%stop p=1]
188− ]
189−
190−------------------------------------------------------------------------
191−
192−### `++char`
193−
194−Char
195−
196−A single character. [odor]() [`@tD`]() designates a single unicode byte. All
197−parsers consume [`++tape`]()s, which are lists of `++char`.
198−
199−
200−Source
201−------
202−
203− ++ char ,@tD :: UTF-8 byte
204−
205−Examples
206−--------
207−
208− ~zod/try=> *char
209− ''
210− ~zod/try> (char 97)
211− 'a'
212−
213−------------------------------------------------------------------------
214−
215−### `++chub`
216−
217−Attach jets
218−
219−Used by the compiler (implicitly by `%sgcn`) to attach jets.
220−
221−Source
222−------
223−
224− ++ chub :: registered battery
225− $: p=(pair chum tyre) :: definition
226− q=* :: battery
227− r=(unit (pair axis chub)) :: parent
228− == ::
229−
230−------------------------------------------------------------------------
231−
232−### `++chum`
233−
234−Jet hint information
235−
236−Jet hint information that must be present in the body of a `~/` or `~%`
237−rune. A `++chum` can optionally contain a kelvin version, jet vendor,
238−and "{major}.{minor}" version number.
239−
240−Source
241−------
242−
243− ++ chum $? lef=term :: jet name
244− [std=term kel=@] :: kelvin version
245− [ven=term pro=term kel=@] :: vendor and product
246− [ven=term pro=term ver=@ kel=@] :: all of the above
247− == ::
248−
249−Examples
250−--------
251−
252−XX there's a ++chum in zuse that's politely causing this not to work
253−
254− ~zod/try=> `chum`'hi'
255− lef=%hi
256−
257− ~zod/try=> (ream '~/(%lob.314 !!)')
258− [%sgfs p=[std=%lob kel=314] q=[%zpzp ~]]
259−
260−------------------------------------------------------------------------
261−
262−### `++clue`
263−
264−Attach jet
265−
266−Used by compiler to attach jets.
267−
268−Source
269−------
270−
271− ++ clue ,[p=axis q=chum r=tyre] :: battery definition
272−
273−XX implementation does not currenlty match docs
274−
275−------------------------------------------------------------------------
276−
277−### `++coil`
278−
279−Tuple of core information
280−
281−Variance `p`, subject type `q`, and `q`: optional compiled nock, and arms. Used as an
282−intermediate step within Section 2fB. Converted by `++core` to %core type.
283−
284−Source
285−------
286−
287− ++ coil $: p=?(%gold %iron %lead %zinc) :: core type
288− q=type ::
289− r=[p=?(~ ^) q=(map term foot)] ::
290− == ::
291−
292−------------------------------------------------------------------------
293−
294−### `++coin`
295−
296−Noun literal syntax cases
297−
298−Noun literal syntax cases: atoms, jammed nouns, and nestable tuples.
299−Parsed and printed using [`++so`]() and [`++co`]() cores.
300−
301−Source
302−------
303−
304− ++ coin $% [%$ p=dime] ::
305− [%blob p=*] ::
306− [%many p=(list coin)] ::
307− == ::
308−
309−Examples
310−--------
311−
312− ~zod/try=> `coin`(need (slay '~s1'))
313− [%$ p=[p=~.dr q=18.446.744.073.709.551.616]]
314− ~zod/try=> `coin`(need (slay '0x2b59'))
315− [%$ p=[p=~.ux q=11.097]]
316−
317− ~zod/try=> ~(rend co [%many ~[[%$ %ud 1] [%$ %tas 'a'] [%$ %s -2]]])
318− "._1_a_-2__"
319− ~zod/try=> ._1_a_-2__
320− [1 %a -2]
321−
322− ~zod/try=> `@uv`(jam [3 4])
323− 0v2cd1
324− ~zod/try=> (slay '~02cd1')
325− [~ [%blob p=[3 4]]]
326− ~zod/try=> ~02cd1
327− [3 4]
328−
329−------------------------------------------------------------------------
330−
331−### `++cord`
332−
333−UTF-8 text
334−
335−One of Hoon's two string types (the other being [`++tape`]()). A cord is an
336−atom of UTF-8 text. [`++trip`]() and [`++crip`]() convert between cord and
337−`++tape`.
338−
339−Source
340−------
341−
342− ++ cord ,@t :: text atom (UTF-8)
343−
344−Examples
345−--------
346−
347−Odor [`@t`]() designates a Unicode atom, little-endian: the first character
348−in the text is the low byte.
349−
350− ~zod/try=> `@ux`'foobar'
351− 0x7261.626f.6f66
352−
353− ~zod/try=> `@`'urbit'
354− 499.984.265.845
355− ~zod/try=> (cord 499.984.265.845)
356− 'urbit'
357−
358−------------------------------------------------------------------------
359−
360−### `++date`
361−
362−Point in time
363−
364−A boolean designating AD or BC, a year atom, a month
365−atom, and a [`++tarp`](), which is a day atom and a time.
366−
367−Source
368−------
369−
370− ++ date ,[[a=? y=@ud] m=@ud t=tarp] :: parsed date
371−
372−Examples
373−--------
374−
375−See also: [`++year`](), [`++yore`]() [`++stud`](), [`++dust`]()
376−
377− ~zod/try=> `date`(yore ~2014.6.6..21.09.15..0a16)
378− [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
379−
380−------------------------------------------------------------------------
381−
382−### `++dime`
383−
384−Odor-atom pair
385−
386−Used in [`++coin`](). Convenience methods [`++scot`]() and [`++scow`]() (in
387−Section 2eL) print dimes as [`++cord`]() and [`++tape`](), respectively.
388−[`++slat`](), [`++slav`](), and [`++slaw`]() are used to parse atoms of
389−specific [odor]()s.
390−
391−Source
392−------
393−
394− ++ dime ,[p=@ta q=@] ::
395−
396−Examples
397−--------
398−
399− ~zod/try=> +>:(slay '0x123')
400− p=[p=~.ux q=291]
401−
402−------------------------------------------------------------------------
403−
404−### `++each`
405−
406−Mold of fork between two
407−
408−[mold]() generator: produces a dicriminated [fork]() between two types.
409−
410−Source
411−------
412−
413− ++ each |*([a=$+(* *) b=$+(* *)] $%([& p=a] [| p=b])) :: either a or b
414−
415−Examples
416−--------
417−
418− ~zod/try=> :type; *(each cord time)
419− [%.y p='']
420− {[%.y p=@t] [%.n p=@da]}
421−
422−------------------------------------------------------------------------
423−
424−### `++edge`
425−
426−Parsing location metadata
427−
428−Optional result `p` and parsing continuation `q`.
429−
430−Source
431−------
432−
433− ++ edge ,[p=hair q=(unit ,[p=* q=nail])] :: parsing output
434−
435−Examples
436−--------
437−
438−See also: Section 2eD, [`++rule`]()
439−
440− ~zod/try=> *edge
441− [p=[p=0 q=0] q=~]
442− ~zod/try=> (tall:vast [1 1] "a b")
443− [p=[p=1 q=2] q=[~ [p=[%cnzz p=~[%a]] q=[p=[p=1 q=2] q=" b"]]]]
444−
445−------------------------------------------------------------------------
446−
447−### `++foot`
448−
449−Cases of arms by variance model.
450−
451−`%ash` arms are [`dry`]() and [geometric]().
452−
453−Source
454−------
455−
456− ++ foot $% [%ash p=twig] :: dry arm, geometric
457− [%elm p=twig] :: wet arm, generic
458− [%oak ~] :: XX not used
459− [%yew p=(map term foot)] :: XX not used
460− == ::
461−
462−Examples
463−--------
464−
465−See also: [`++ap`](), [`++ut`]()
466−
467− ~zod/try=> *foot
468− [%yew p={}]
469−
470− ~zod/try=> (ream '|% ++ $ foo --')
471− [%brcn p={[p=%$ q=[%ash p=[%cnzz p=~[%foo]]]]}]
472− ~zod/try=> +<+:(ream '|% ++ $ foo --')
473− t=~[%ash %cnzz %foo]
474− ~zod/try=> (foot +<+:(ream '|% ++ $ foo --'))
475− [%ash p=[%cnzz p=~[%foo]]]
476− ~zod/try=> (foot +<+:(ream '|% +- $ foo --'))
477− [%elm p=[%cnzz p=~[%foo]]]
478−
479−------------------------------------------------------------------------
480−
481−### `++gate`
482−
483−Function
484−
485−A core with one arm, `$`--the empty name--which transforms a sample noun into a product
486−noun. If used [dryly]() as a type, the [subject]() must have a sample type of [`*`]().
487−
488−
489−Source
490−------
491−
492− ++ gate $+(* *) :: general gate
493−
494−Examples
495−--------
496−
497−See also: [`++lift`](), [`++cork`]()
498−
499− ~zod/try=> *gate
500− <1|mws [* <101.jzo 1.ypj %164>]>
501− ~zod/try=> `gate`|=(* 0)
502− <1|mws [* <101.jzo 1.ypj %164>]>
503−
504− ~zod/try=> (|=(a=* [a 'b']) 'c')
505− [99 'b']
506− ~zod/try=> (`gate`|=(a=* [a 'b']) 'c')
507− [99 98]
508−
509−------------------------------------------------------------------------
510−
511−### `++hair`
512−
513−Parsing line and column
514−
515−A pair of two [`@ud`]() used in parsing indicating line and column number.
516−
517−Source
518−------
519−
520− ++ hair ,[p=@ud q=@ud] :: parsing trace
521−
522−Examples
523−--------
524−
525− ~zod/try=> *hair
526− [p=0 q=0]
527−
528− ~zod/try=> `hair`[1 1] :: parsing starts at [1 1] as a convention.
529− [p=1 q=1]
530− ~zod/try=> ((plus ace) [1 1] " --")
531− [p=[p=1 q=4] q=[~ u=[p=[~~. " "] q=[p=[p=1 q=4] q="--"]]]]
532− ~zod/try=> `hair`p:((plus ace) [1 1] " --")
533− [p=1 q=4]
534−
535−------------------------------------------------------------------------
536−
537−### `++like`
538−
539−Mold generator for an edge
540−
541−`++like` generates an `++edge` with a parsed result set to a specific type.
542−
543−Source
544−------
545−
546− ++ like |* a=_,* :: generic edge
547− ?@ +.b ~ ::
548− :- ~ ::
549− u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] ::
550−
551−Examples
552−--------
553− ~zod/try=> *(like char)
554− [p=[p=0 q=0] q=~]
555−
556− ~zod/try=> (ace [1 1] " a")
557− [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="a"]]]]
558− ~zod/try=> `(like char)`(ace [1 1] " a")
559− [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="a"]]]]
560− ~zod/try=> `(like ,@)`(ace [1 1] " a")
561− [p=[p=1 q=2] q=[~ [p=32 q=[p=[p=1 q=2] q="a"]]]]
562−
563−------------------------------------------------------------------------
564−
565−### `++limb`
566−
567− ++ limb $|(term $%([%& p=axis] [%| p=@ud q=term])) ::
568−
569−XX move to `++ut`
570−
571−Reference into subject by name/axis
572−
573−See also: section 2fC-2fD
574−
575− ~zod/try=> (ream '^^$')
576− [%cnzz p=~[[%.n p=2 q=%$]]]
577− ~zod/try=> (limb &2:(ream '^^$'))
578− [%.n p=2 q=%$]
579− ~zod/try=> (limb &2:(ream '^^^$'))
580− [%.n p=3 q=%$]
581−
582−------------------------------------------------------------------------
583−
584−### `++line`
585−
586−XX move to `++ut`
587−
588−Source
589−------
590−
591− ++ line ,[p=[%leaf p=odor q=@] q=tile] :: %kelp case
592−
593−
594−Examples
595−--------
596−
597− ~zod/try=> (ream '$%([1 a] [%2 b])')
598− [ %bccm
599− p
600− [ %kelp
601− p
602− [ i=[p=[%leaf p=~.ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
603− t=~[[p=[%leaf p=~.ud q=2] q=[%herb p=[%cnzz p=~[%b]]]]]
604− ]
605− ]
606− ]
607− ~zod/try=> &3:(ream '$%([1 a] [%2 b])')
608− p=[p=[%leaf p=%ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
609− ~zod/try=> (line &3:(ream '$%([1 a] [%2 b])'))
610− [p=[%leaf p=~.ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
611−
612−------------------------------------------------------------------------
613−
614−### `++list`
615−
616−List
617−
618−[mold]() generator. `++list` generates a mold of a null-termanated list of a
619−homogenous type.
620−
621−
622−Source
623−------
624−
625− ++ list |* a=_,* :: null-term list
626−
627−Examples
628−--------
629−
630−See also: [`++turn`](), [`++snag`]()
631−
632− ~zod/try=> *(list)
633− ~
634− ~zod/try=> `(list ,@)`"abc"
635− ~[97 98 99]
636− ~zod/try=> (snag 0 "abc")
637− ~~a
638−
639−------------------------------------------------------------------------
640−
641−### `++lone`
642−
643−Tile generator. `++lone` puts face of `p` on something.
644−
645−XX unused
646−
647−Source
648−------
649−
650− ++ lone |*(a=$+(* *) ,p=a) :: just one thing
651−
652−------------------------------------------------------------------------
653−
654−### `++mane`
655−
656−XML name
657−
658−An XML name (tag name or attribute name) with an optional namespace. Parsed by
659−[`++name`]() within [`++poxa`](), rendered by [`++name`]() within `++poxo`.
660−
661−Source
662−------
663−
664− ++ mane $|(@tas [@tas @tas]) :: XML name/space
665−
666−Examples
667−--------
668−
669−See also: [`++sail`]()
670−
671− ~zod/try=> *mane
672− %$
673−
674− ~zod/try=> `mane`n.g:`manx`;div:namespace;
675− %div
676− ~zod/try=> `mane`n.g:`manx`;div_namespace;
677− [%div %namespace]
678−
679−------------------------------------------------------------------------
680−
681−### `++manx`
682−
683−XML node.
684−
685−Parsed by [`++apex`]() within [`++poxa`](), rendered by [`++poxo`]().
686−
687−Source
688−------
689−
690− ++ manx ,[g=marx c=marl] :: XML node
691−
692−Examples
693−--------
694−
695−See also: [`++sail`]() doc
696−
697−------------------------------------------------------------------------
698−
699−### `++marl`
700−
701−List of XML nodes
702−
703−A list of [`++manx`]().
704−
705−Source
706−------
707−
708− ++ marl (list manx) :: XML node list
709−
710−Examples
711−--------
712−
713−
714−------------------------------------------------------------------------
715−
716−### `++mars`
717−
718−XML CDATA
719−
720−Implicitly produced by [`++chrd`]() within [`++poxa`]()
721−
722−Source
723−------
724−
725− ++ mars ,[t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata
726−
727−Examples
728−--------
729−
730−------------------------------------------------------------------------
731−
732−### `++mart`
733−
734−List of XML attributes
735−
736−Each `++mart` is a list of pairs of [`++mane`]() and
737−[`++tape`]().
738−
739−Parsed by [`++attr`]() within [`++poxa`](), rendered by `++attr` within [`++poxo`]()
740−
741−Source
742−------
743−
744− ++ mart (list ,[n=mane v=tape]) :: XML attributes
745−
746−Examples
747−--------
748−
749−------------------------------------------------------------------------
750−
751−### `++marx`
752−
753−XML tag
754−
755−A `++marx` is a pair of a tag name, `++mane` and a list of attributes,
756−`++mart`. Parsed by [`++head`]() `++poxa`, rendered within `++poxo`.
757−
758−Source
759−------
760−
761− ++ marx ,[n=mane a=mart] :: XML tag
762−
763−Examples
764−--------
765−
766−------------------------------------------------------------------------
767−
768−### `++metl`
769−
770− ++ metl ?(%gold %iron %zinc %lead) :: core variance
771−
772−XX move to `++ut`
773−
774−See also: [`++coil`]()
775−
776−------------------------------------------------------------------------
777−
778−### `++noun`
779−
780− ++ noun ,* :: any noun
781−
782−Used nowhere XX
783−
784− ~zod/try=> `noun`~[1 2 3]
785− [1 2 3 0]
786−
787−------------------------------------------------------------------------
788−
789−### `++null`
790−
791− ++ null ,~ :: null, nil, etc
792−
793−Used nowhere XX
794−
795− ~zod/try=> :type; *null
796− ~
797− %~
798−
799−------------------------------------------------------------------------
800−
801−### `++odor`
802−
803−'type' of atom
804−
805−By convention, a short name for a category of atom. `++odor` is
806−circularly defined, with [`@ta`]() being the `++odor` of the ASCII subset
807−commonly used in urbit.
808−
809−Source
810−------
811−
812− ++ odor ,@ta :: atom format
813−
814−Examples
815−--------
816−
817−See also: [`++base`](), [odor reference]()
818−
819− ~zod/try=> `odor`%ux
820− ~.ux
821−
822−------------------------------------------------------------------------
823−
824−### `++tarp`
825−
826−Day through second
827−
828−The remaining part of a [`++date`](): day, hour, minute, second and a list
829−of [`@ux`]() for precision.
830−
831−Source
832−------
833−
834− @ud h=@ud m=@ud s=@ud f=(list ,@ux)] :: parsed time
835−
836−Examples
837−--------
838−
839−See also: [`++date`](), [`++yell`[]()/`++yule`]()
840−
841− ~zod/try=> -<-
842− ~2014.9.20..00.43.33..b52a
843− ~zod/try=> :: the time is always in your context at -<-
844− ~zod/try=> (yell -<-)
845− [d=106.751.991.820.278 h=0 m=43 s=39 f=~[0x54d1]]
846−
847− ~zod/try=> (yell ~d20)
848− [d=20 h=0 m=0 s=0 f=~]
849−
850−------------------------------------------------------------------------
851−
852−### `++time`
853−
854−Absolute date
855−
856−The `@da` odor designates an absolute date atom.
857−
858−Source
859−------
860−
861− ++ time ,@da :: galactic time
862−
863−Examples
864−--------
865−
866−See also: [`++date`](), [odor reference]()
867−
868− ~zod/try=> `time`-<-
869− ~2014.9.25..20.01.47..eeac
870− ~zod/try=> :: the time is always in your context at -<-
871− ~zod/try=> `time`~2014.1.1
872− ~2014.1.1
873−
874−------------------------------------------------------------------------
875−
876−### `++tree`
877−
878−Tree mold generator
879−
880−A `++tree` can be empty, or contain a node of a type and
881−left/right sub `++tree` of the same type. Pretty-printed with `{}`.
882−
883−Source
884−------
885−
886− ++ tree |* a=_,* :: binary tree
887−
888−Examples
889−--------
890−
891− ~zod/try=> `(tree ,[@ tape])`[[1 "hi"] [[2 "bye"] ~ ~] ~]
892− {[2 "bye"] [1 "hi"]}
893−
894−------------------------------------------------------------------------
895−
896−### `++nail`
897−
898−Location, remainder of parsed text
899−
900−Indicates parsing position `p`, and remaining text to be parsed `q`.
901−
902−Source
903−------
904−
905− ++ nail ,[p=hair q=tape] :: parsing input
906−
907−Examples
908−--------
909−
910− ~zod/try=> +<:;~(plug cab cab)
911− c=tub=[p=[p=0 q=0] q=""]
912− ~zod/try=> :: tub is a ++nail
913−
914−------------------------------------------------------------------------
915−
916−### `++numb`
917−
918− ++ numb ,@ :: just a number
919−
920−Used nowhere XX
921−
922−------------------------------------------------------------------------
923−
924−### `++pair`
925−
926−Mold of pair of types
927−
928−[mold]() generator. Produces a tuple of two of the types passed in.
929−
930−
931−Source
932−------
933−
934− ++ pair |*([a=$+(* *) b=$+(* *)] ,[p=a q=b]) :: just a pair
935−
936−
937−Examples
938−--------
939−
940− ~zod/try=> *(pair bean cord)
941− [p=%.y q='']
942−
943−------------------------------------------------------------------------
944−
945−### `++pass`
946−
947−Atom alias
948−
949−Used primarily in crypto.
950−
951−Source
952−------
953−
954− ++ pass ,@ :: public key
955−
956−------------------------------------------------------------------------
957−
958−### `++path`
959−
960−Filesystem path
961−
962−A `++path` is a list of [`++span`]()s aka [`@ta`](). Used in
963−`%clay` and `%eyre` extensively.
964−
965−Source
966−------
967−
968− ++ path (list span) :: filesys location
969−
970−Examples
971−--------
972−
973− ~zod/try=> `path`"abc"
974− /a/b/c
975−
976−------------------------------------------------------------------------
977−
978−### `++pint`
979−
980−Parsing range
981−
982−Mostly used for stacktraces. A `++pint` is a pair of
983−[`++hair`](), indicating from `p` to `q`.
984−
985−Source
986−------
987−
988− ++ pint ,[p=[p=@ q=@] q=[p=@ q=@]] :: line/column range
989−
990−Examples
991−--------
992−
993− ~zod/try=> !:(!!)
994− ! /~zod/try/~2014.9.20..01.22.04..52e3/:<[1 4].[1 6]>
995− ~zod/try=> :: !! always produces a crash
996− ~zod/try=> `pint`[[1 4] [1 6]]
997− [p=[p=1 q=4] q=[p=1 q=6]]
998−
999−------------------------------------------------------------------------
1000−
1001−### `++pole`
1002−
1003−Faceless list
1004−
1005−A [`++list`]() without the [face]()s `i` and `t`.
1006−
1007−Source
1008−------
1009−
1010− ++ pole |* a=_,* :: nameless list
1011−
1012−Examples
1013−--------
1014−
1015− ~zod/try=> `(pole char)`"asdf"
1016− [~~a [~~s [~~d [~~f ~]]]]
1017−
1018−------------------------------------------------------------------------
1019−
1020−### `++port`
1021−
1022−XX move to `++ut`
1023−
1024−Type and location of core-shaped thing? XX Compiler Internals
1025−
1026−Source
1027−------
1028−
1029− ++ port $: p=axis ::
1030− $= q ::
1031− $% [%& p=type] ::
1032− [%| p=axis q=(list ,[p=type q=foot])] ::
1033− == ::
1034− == ::
1035−
1036−Examples
1037−--------
1038−
1039− ~zod/try=> *port
1040− [p=0 q=[%.y p=%void]]
1041−
1042−------------------------------------------------------------------------
1043−
1044−### `++post`
1045−
1046−XX move to `++ut`
1047−
1048−Type and location of possibly core-shaped thing? XX Compiler Internals
1049−
1050−Source
1051−------
1052−
1053− ++ post $: p=axis ::
1054− $= q ::
1055− $% [0 p=type] ::
1056− [1 p=axis q=(list ,[p=type q=foot])] ::
1057− [2 p=twin q=type] ::
1058− == ::
1059− == ::
1060−
1061−Examples
1062−--------
1063−
1064− ~zod/try=> *post
1065− [p=0 q=[%0 p=%void]]
1066−
1067−------------------------------------------------------------------------
1068−
1069−### `++prop`
1070−
1071−XX move to `++ut`
1072−
1073−Verified core-shaped thing? XX Compiler Internals
1074−
1075− ~zod/try=> *prop
1076− [p=0 q=[p=~ q=~]]
1077−
1078−------------------------------------------------------------------------
1079−
1080−### `++qual`
1081−
1082−Mold of 4 type tuple
1083−
1084−A `++qual` is a tuple of four of the types passed in.
1085−
1086−Source
1087−------
1088−
1089− ++ qual |* [a=$+(* *) b=$+(* *) c=$+(* *) d=$+(* *)] :: just a quadruple
1090−
1091−Examples
1092−--------
1093−
1094− ~zod/try=> *(qual date time tape cord)
1095− [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s='']
1096−
1097−------------------------------------------------------------------------
1098−
1099−### `++rege`
1100−
1101−Regex caases
1102−
1103−`++rege` defines the cases of a regular expression.
1104−
1105−Source
1106−------
1107−
1108− ++ rege $| ?(%dote %ende %sart %empt %boun %bout) :: parsed regex
1109− [%brac p=@] :: p is 256 bitmask
1110− [%eith p=rege q=rege] :: either
1111− [%mant p=rege] :: greedy 0 or more
1112− [%plls p=rege] :: greedy 1 or more
1113− [%betw p=rege q=@u r=@u] :: between q and r
1114− [%bint p=rege q=@u] :: min q
1115− [%bant p=rege q=@u] :: exactly q
1116− [%manl p=rege] :: lazy 0 or more
1117− [%plll p=rege] :: lazy 1 or more
1118− [%betl p=rege q=@u r=@u] :: between q and r lazy
1119− [%binl p=rege q=@u] :: min q lazy
1120− == ::
1121−
1122−Examples
1123−--------
1124−
1125−See also: [`++rexp`](), [`++repg`](), [`++pars`]()
1126−
1127− ~zod/try=> (pars "[a-z]")
1128− [~ [%brac p=10.633.823.807.823.001.954.701.781.295.154.855.936]]
1129− ~zod/try=> (rexp "[a-z]" "abc1")
1130− [~ [~ {[p=0 q="a"]}]]
1131−
1132−------------------------------------------------------------------------
1133−
1134−### `++ring`
1135−
1136−Atom alias
1137−
1138−Used primarily in crypto.
1139−
1140−Source
1141−------
1142−
1143− ++ ring ,@ :: private key
1144−
1145−------------------------------------------------------------------------
1146−
1147−### `++rule`
1148−
1149−Parsing rule
1150−
1151−`++rule` is an empty parsing rule, but it is used to check
1152−that parsing rules match this with `_`.
1153−
1154−
1155−Source
1156−------
1157−
1158− ++ rule |=(tub=nail `edge`[p.tub ~ ~ tub]) :: parsing rule
1159−
1160−Examples
1161−--------
1162−
1163− ~zod/try=> *rule
1164− [p=[p=0 q=0] q=[~ [p=0 q=[p=[p=0 q=0] q=""]]]]
1165−
1166− ~zod/try=> ^+(rule [|=(a=nail [p.a ~])]:|6)
1167− <1.dww [tub=[p=[p=@ud q=@ud] q=""] <101.jzo 1.ypj %164>]>
1168− ~zod/try=> (^+(rule [|=(a=nail [p.a ~ u=['a' a]])]:|6) [1 1] "hi")
1169− [p=[p=1 q=1] q=[~ [p=97 q=[p=[p=1 q=1] q="hi"]]]]
1170− ~zod/try=> ([|=(a=nail [p.a ~ u=['a' a]])]:|6 [1 1] "hi")
1171− [[p=1 q=1] ~ u=['a' p=[p=1 q=1] q="hi"]]
1172−
1173−------------------------------------------------------------------------
1174−
1175−### `++span`
1176−
1177−ASCII atom
1178−
1179−A restricted text atom for canonical atom syntaxes. The prefix is `~.`.
1180−There are no escape sequences except `~~`, which means `~`, and `~-`,
1181−which means `_`. `-` and `.` encode themselves. No other characters
1182−besides numbers and lowercase letters are permitted.
1183−
1184−Source
1185−------
1186−
1187− ++ span ,@ta :: text-atom (ASCII)
1188−Examples
1189−--------
1190− ~zod/try=> *span
1191− ~.
1192−
1193− ~zod/try=> `@t`~.foo
1194− 'foo'
1195− ~zod/try=> `@t`~.foo.bar
1196− 'foo.bar'
1197− ~zod/try=> `@t`~.foo~~bar
1198− 'foo~bar'
1199− ~zod/try=> `@t`~.foo~-bar
1200− 'foo_bar'
1201− ~zod/try=> `@t`~.foo-bar
1202− 'foo-bar'
1203−
1204−------------------------------------------------------------------------
1205−
1206−### `++spot`
1207−
1208−Stack trace line
1209−
1210−A [`++spot`]() is what we print after crashing.
1211−
1212−Source
1213−------
1214−
1215− ++ spot ,[p=path q=pint] :: range in file
1216−
1217−Examples
1218−--------
1219−
1220− ~zod/try=> :into /=main=/bin/fail/hoon '!: !!'
1221− + /~zod/main/359/bin/fail/hoon
1222− ~zod/try=> :fail
1223− ! /~zod/main/~2014.9.22..18.40.56..ef04/bin/fail/:<[1 5].[1 7]>
1224− ! exit
1225−
1226−------------------------------------------------------------------------
1227−
1228−### `++tang`
1229−
1230− ++ tang (list tank) :: general error
1231−
1232−Unused XX
1233−
1234−------------------------------------------------------------------------
1235−
1236−### `++tank`
1237−
1238−Pretty-printing structure.
1239−
1240−A `++tank` is one of three cases: a `%leaf`
1241−is simply a string; a `%palm` is XX need more information; and a `%rose` is a
1242−list of `++tank` delimted by the strings in `p`.
1243−
1244−
1245−Source
1246−------
1247−
1248− ++ tank $% [%leaf p=tape] :: printing formats
1249− $: %palm :: backstep list
1250− p=[p=tape q=tape r=tape s=tape] ::
1251− q=(list tank) ::
1252− == ::
1253− $: %rose :: flat list
1254− p=[p=tape q=tape r=tape] :: mid open close
1255− q=(list tank) ::
1256− == ::
1257− ==
1258−
1259−Examples
1260−--------
1261−
1262− ~zod/try=> >(bex 20) (bex 19)<
1263− [%rose p=[p=" " q="[" r="]"] q=~[[%leaf p="1.048.576"] [%leaf p="524.288"]]]
1264− ~zod/try=> (wash [0 80] >(bex 20) (bex 19)<) :: at 80 cols
1265− <<"[1.048.576 524.288]">>
1266− ~zod/try=> (wash [0 15] >(bex 20) (bex 19)<) :: at 15 cols (two lines)
1267− <<"[ 1.048.576" " 524.288" "]">>
1268−
1269− ~zod/try=> [(bex 150) (bex 151)] :: at 80 cols
1270− [ 1.427.247.692.705.959.881.058.285.969.449.495.136.382.746.624
1271− 2.854.495.385.411.919.762.116.571.938.898.990.272.765.493.248
1272− ]
1273−
1274------------------------------------------------------------------------
8------------------------------------------------------------------------
1275
9
1276−### `++tape`
10+-----------------------------------------------------------------------
1277−
1278−List of chars
1279−
1280−One of Hoon's two string types, the other being [`++cord`](). A tape is a
1281−list of chars.
1282−
1283−Source
1284−------
1285−
1286− ++ tape (list char) :: like a string
1287−
1288−Examples
1289−--------
1290−
1291− ~zod/try=> `(list ,char)`"foobar"
1292− "foobar"
1293− ~zod/try=> `(list ,@)`"foobar"
1294− ~[102 111 111 98 97 114]
1295
11
1296------------------------------------------------------------------------
12------------------------------------------------------------------------
1297
13
1298−### `++term`
1299−
1300−Hoon constants
1301−
1302−A restricted text atom for Hoon constants. The only characters permitted are
1303−lowercase ASCII, `-`, and `0-9`, the latter two of which can neither be the first or last
1304−character. The syntax for [`@tas`]() is the text itself, always preceded by `%`.
1305−This means a term is always [cubical](). The empty `@tas` has a special syntax,
1306−`$`.
1307−
1308−
1309−Source
1310−------
1311−
1312− ++ term ,@tas :: Hoon ASCII subset
1313−
1314−Examples
1315−--------
1316−
1317− ~zod/try=> *term
1318− %$
1319−
1320− ~zod/try=> %dead-fish9
1321− %dead-fish9
1322− ~zod/try=> -:!>(%dead-fish9)
1323− [%cube p=271.101.667.197.767.630.546.276 q=[%atom p=%tas]]
1324−
1325------------------------------------------------------------------------
14------------------------------------------------------------------------
1326
15
1327−### `++tiki`
1328−
1329−XX move to `++ut`
1330−
1331−Source
1332−------
1333−
1334− ++ tiki :: test case
1335−
1336−Examples
1337−--------
1338−
1339−A `++wing` or `++twig`.
1340−
1341− ~zod/try=> (ream '=+ a=4 ?-(a @ ~)')
1342− [ %tsls
1343− p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]]
1344− q
1345− [ %wthz
1346− p=[%.y p=~ q=~[%a]]
1347− q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]]
1348− ]
1349− ]
1350− ~zod/try=> (ream '=+ a=4 ?-(4 @ ~)')
1351− [ %tsls
1352− p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]]
1353− q
1354− [ %wthz
1355− p=[%.n p=~ q=[%dtzy p=%ud q=4]]
1356− q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]]
1357− ]
1358− ]
1359
16
1360------------------------------------------------------------------------
17------------------------------------------------------------------------
1361
18
1362−### `++toga`
1363−
1364−Tree of faces
1365−
1366−A [face](), or tree of faces. A `++toga` is applied to anything assigned
1367−using [`^=`]().
1368−
1369−XX move to `++ut` and rune doc (for \^= examples)
1370−
1371−Source
1372−------
1373−
1374− ++ toga :: face control
1375− [2 p=toga q=toga] :: cell toga
1376− == ::
1377−
1378−Examples
1379−--------
1380−
1381− ~zod/try=> a=1
1382− a=1
1383− ~zod/try=> (ream 'a=1')
1384− [%ktts p=p=%a q=[%dtzy p=%ud q=1]]
1385− ~zod/try=> [a b]=[1 2 3]
1386− [a=1 b=[2 3]]
1387− ~zod/try=> (ream '[a b]=[1 2 3]')
1388− [ %ktts
1389− p=[%2 p=p=%a q=p=%b]
1390− q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
1391− ]
1392−
1393− ~zod/try=> [a ~]=[1 2 3]
1394− [a=1 2 3]
1395− ~zod/try=> (ream '[a ~]=[1 2 3]')
1396− [ %ktts
1397− p=[%2 p=p=%a q=[%0 ~]]
1398− q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
1399− ]
1400−
1401------------------------------------------------------------------------
19------------------------------------------------------------------------
1402
20
1403−### `++trap`
1404−
1405−Core with one arm `$`
1406−
1407−A trap is a core with one arm `++$`. Used when XX
1408−
1409−Source
1410−------
1411−
1412− ++ trap ,_|.(_*) :: makes perfect sense
1413−
1414−Examples
1415−--------
1416−
1417−See also: `|.`
1418−
1419− ~zod/try=> *trap
1420− <1.mws 101.jzo 1.ypj %164>
1421− ~zod/try=> (*trap)
1422− 0
1423− ~zod/try=> (|.(42))
1424− 42
1425
21
1426------------------------------------------------------------------------
22------------------------------------------------------------------------
1427
23
1428−### `++trel`
1429−
1430−Mold of three types
1431−
1432−[`++mold`]() of the tuple of the three types passed in.
1433−
1434−Source
1435−------
1436−
1437− ++ trel |* [a=$+(* *) b=$+(* *) c=$+(* *)] :: just a triple
1438−
1439−Examples
1440−--------
1441−
1442− ~zod/try=> *(trel ,@ud ,@t ,@s)
1443− [p=0 q='' r=--0]
1444−
1445------------------------------------------------------------------------
24------------------------------------------------------------------------
1446
25
1447−### `++tuna`
1448−
1449−XML template tree
1450−
1451−An XML template tree.
1452−
1453−Source
1454−------
1455−
1456− ++ tuna :: tagflow
1457− [%d p=twig] :: dynamic list
1458− [%e p=twig q=(list tuna)] :: element
1459− [%f p=(list tuna)] :: subflow
1460− == ::
1461−
1462−Examples
1463−--------
1464−
1465−Leaf %a contains plain-text, %b an empty tag, %c a static list, %d a
1466−dynamic list, %e a full node element containing a twig and a list of
1467−tuna, and %f is a empty node.
1468−
1469−See also: [`++sail`]()
1470−
1471------------------------------------------------------------------------
26------------------------------------------------------------------------
1472
27
1473−### `++twig`
1474−
1475−Expression
1476−
1477−An expression, or AST.
1478−
1479−See Twig section of Hoon reference
1480−
1481------------------------------------------------------------------------
28------------------------------------------------------------------------
1482
29
1483−### `++tine`
1484−
1485−Switch statement cases
1486−
1487−In [`?-`](), for example, your list of cases is a `++tine`.
1488−
1489−Source
1490−------
1491−
1492− ++ tine (list ,[p=tile q=twig]) ::
1493−
1494−Examples
1495−--------
1496−
1497− ~zod/try=> (ream '?-(!! @ |, ^ &)')
1498− [ %wthz
1499− p=[%.n p=~ q=[%zpzp ~]]
1500− q
1501− ~[
1502− [p=[%axil p=[%atom p=~.]] q=[%dtzy p=%f q=1]]
1503− [p=[%axil p=%cell] q=[%dtzy p=%f q=0]]
1504− ]
1505− ]
1506− ~zod/try=> (tine |2:(ream '?-(!! @ |, ^ &)'))
1507− ~[
1508− [p=[%axil p=[%atom p=~.]] q=[%dtzy p=%f q=1]]
1509− [p=[%axil p=%cell] q=[%dtzy p=%f q=0]]
1510− ]
1511−
1512------------------------------------------------------------------------
30------------------------------------------------------------------------
1513
31
1514−### `++tusk`
1515−
1516−List of expressions
1517−
1518−List of [`++twig`]()s. In [`:*`](), for example, your contents is
1519−a `++tusk`.
1520−
1521−Source
1522−------
1523−
1524− ++ tusk (list twig) ::
1525−
1526−Examples
1527−--------
1528−
1529− ~zod/try=> (ream '[1 2 3]')
1530− [%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
1531− ~zod/try=> (tusk +:(ream '[1 2 3]'))
1532− ~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]
1533−
1534------------------------------------------------------------------------
32------------------------------------------------------------------------
1535
33
1536−### `++tyre`
1537−
1538−List, term to twig
1539−
1540−Associative list of [++term]() [`++twig`](), used in [jet]() hint processing.
1541−
1542−Source
1543−------
1544−
1545− ++ tyre (list ,[p=term q=twig]) ::
1546−
1547------------------------------------------------------------------------
34------------------------------------------------------------------------
1548
35
1549−### `++tyke`
1550−
1551−List of 'maybe' twigs
1552−
1553−List of [`++unit`]() [`++twig`](), or gaps left to be inferred, in [`++path`]()
1554−parsing. When you use a path such as `/=main=/pub/src/doc` the path is in fact
1555−a `++tyke`, where the `=` are inferred from your current path.
1556−
1557−
1558−Source
1559−------
1560−
1561− ++ tyke (list (unit twig)) ::
1562−
1563−Examples
1564−--------
1565−
1566− ~zod/try=> (scan "/==as=" porc:vast)
1567− [0 ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]]
1568− ~zod/try=> `tyke`+:(scan "/==as=" porc:vast)
1569− ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]
1570−
1571------------------------------------------------------------------------
36------------------------------------------------------------------------
1572
37
1573−### `++tram`
1574−
1575−List of changes
1576−
1577−List of changes by location in context. When using [`%=`](), for example,
1578−the list of changes is a `++tram`.
1579−
1580−Source
1581−------
1582−
1583− ++ tram (list ,[p=wing q=twig]) ::
1584−
1585−Examples
1586−--------
1587−
1588− ~zod/try=> (ream '$(a 1, b 2)')
1589− [ %cnts
1590− p=~[%$]
1591− q=~[[p=~[%a] q=[%dtzy p=%ud q=1]] [p=~[%b] q=[%dtzy p=%ud q=2]]]
1592− ]
1593− ~zod/try=> (tram +:(ream '$(a 1, b 2)'))
1594− ~[[p=~ q=[% p=0]] [p=~[%a] q=[%dtzy p=%ud q=1]] [p=~[%b] q=[%dtzy p=%ud q=2]]]
1595−
1596------------------------------------------------------------------------
38------------------------------------------------------------------------
1597
39
1598−### `++nock`
1599−
1600−Virtual machine. See [Nock doc]().
1601−
1602−
1603−Source
1604−------
1605−
1606− ++ nock $& [p=nock q=nock] :: autocons
1607− [%3 p=nock] :: cell test
1608− [%4 p=nock] :: increment
1609− [%5 p=nock q=nock] :: equality test
1610− [%6 p=nock q=nock r=nock] :: if, then, else
1611− [%7 p=nock q=nock] :: serial compose
1612− [%8 p=nock q=nock] :: push onto subject
1613− [%9 p=@ q=nock] :: select arm and fire
1614− [%10 p=?(@ [p=@ q=nock]) q=nock] :: hint
1615− [%11 p=nock] :: grab data from sky
1616− == ::
1617−
1618−Examples
1619−--------
1620−
1621− ~zod/try=> !=([+(.) 20 -<])
1622− [[4 0 1] [1 20] 0 4]
1623− ~zod/try=> (nock !=([+(.) 20]))
1624− [p=[%4 p=[%0 p=1]] q=[%1 p=20]]
1625
40
1626------------------------------------------------------------------------
41------------------------------------------------------------------------
1627
42
1628−### `++tone`
1629−
1630−Intermediate Nock computation result
1631−
1632−Similar to [`++toon`](), but stack trace is not yet rendered.
1633−
1634−Source
1635−------
1636−
1637− ++ tone $% [%0 p=*] :: success
1638−
1639−Examples
1640−--------
1641−
1642− ~zod/try=> (mink [[20 21] 0 3] ,~)
1643− [%0 p=21]
1644−
1645− ~zod/try=> (mink [[0] !=(.^(cy//=main/1))] ,~)
1646− [%1 p=~[[31.075 1.685.027.454 1.852.399.981 49 0]]]
1647− ~zod/try=> (path [31.075 1.685.027.454 1.852.399.981 49 0])
1648− /cy/~zod/main/1
1649−
1650− ~zod/try=> (mink [[1 2] !=(~|(%hi +(.)))] ,~)
1651− [%2 p=~[[~.yelp 26.984]]]
1652− ~zod/try=> (mink [[1 2] !=(!:(+(.)))] ,~)
1653− [ %2
1654− p
1655− ~[
1656− [ ~.spot
1657− [ [ 1.685.027.454
1658− 7.959.156
1659− \/159.445.990.350.374.058.574.398.238.344.143.957.205.628.479.572.65\/
1660− 8.112.403.878.526
1661− \/ \/
1662− 0
1663− ]
1664− [1 20]
1665− 1
1666− 24
1667− ]
1668− ]
1669− ]
1670− ]
1671−
1672------------------------------------------------------------------------
43------------------------------------------------------------------------
1673
44
1674−### `++toon`
1675−
1676−Nock computation result
1677−
1678−Either success (`%0`), a block with list of requests blocked on (`%1`), or
1679−failure with stack trace (`%2`).
1680−
1681−Source
1682−------
1683−
1684− ++ toon $% [%0 p=*] :: success
1685−
1686−Examples
1687−--------
1688− ~zod/try=> (mock [[20 21] 0 3] ,~)
1689− [%0 p=21]
1690−
1691− ~zod/try=> (mock [[0] !=(.^(cy//=main/1))] ,~)
1692− [%1 p=~[[31.075 1.685.027.454 1.852.399.981 49 0]]]
1693− ~zod/try=> (path [31.075 1.685.027.454 1.852.399.981 49 0])
1694− /cy/~zod/main/1
1695−
1696− ~zod/try=> (mock [[1 2] !=(!:(+(.)))] ,~)
1697− [%2 p=~[[%leaf p="/~zod/try/~2014.9.23..18.34.32..d3c5/:<[1 20].[1 24]>"]]]
1698−
1699------------------------------------------------------------------------
45------------------------------------------------------------------------
1700
46
1701−### `++tune`
1702−
1703−
1704−Source
1705−------
1706−
1707− ++ tune $% [%0 p=vase] ::
1708−
1709−Examples
1710−--------
1711−Probably typed `tone`?
1712−
1713------------------------------------------------------------------------
47------------------------------------------------------------------------
1714
48
1715−### `++twin`
1716−
1717−Aliasing
1718−
1719−Used in `%bull` within [`++type`]() to typecheck aliased faces.
1720−
1721−Source
1722−------
1723−
1724− ++ twin ,[p=term q=wing r=axis s=type] :: alias info
1725−
1726−Examples
1727−--------
1728−
1729− ~zod/try=> (~(busk ut %cell %noun [%atom %ud]) %fal [%& 3]~)
1730− [ %bull
1731− p=[p=%fal q=~[[%.y p=3]] r=3 s=[%atom p=%ud]]
1732− q=[%cell p=%noun q=[%atom p=%ud]]
1733− ]
1734− ~zod/try=> &2:(~(busk ut %cell %noun [%atom %ud]) %fal [%& 3]~)
1735− p=[p=%fal q=~[[%.y p=3]] r=3 s=[%atom p=%ud]]
1736− ~zod/try=> (twin &2:(~(busk ut %cell %noun [%atom %ud]) %fal [%& 3]~))
1737− [p=%fal q=~[[%.y p=3]] r=3 s=[%atom p=%ud]]
1738−
1739------------------------------------------------------------------------
49------------------------------------------------------------------------
1740
50
1741−### `++type`
1742−
1743−See Type section of Hoon reference
1744−
1745------------------------------------------------------------------------
51------------------------------------------------------------------------
1746
52
1747−### `++typo`
1748−
1749−Pointer for `++type`
1750−
1751−Pointer for [`++type`](). `++typo` preserves the previous `++type` in your
1752−context when upating.
1753−
1754−Source
1755−------
1756−
1757− ++ typo type :: old type
1758−
1759−Examples
1760−--------
1761−
1762−See also: `++seem`, `++vise`, `++type`
1763−
1764------------------------------------------------------------------------
53------------------------------------------------------------------------
1765
54
1766−### `++udal`
1767−
1768−Source
1769−------
1770−
1771− ++ udal :: atomic change (%b)
1772−
1773−Examples
1774−--------
1775------------------------------------------------------------------------
55------------------------------------------------------------------------
1776
56
1777−### `++udon`
1778−
1779− ++ udon :: abstract delta
1780− $: p=umph :: preprocessor
1781− $= q :: patch
1782− $% [%a p=* q=*] :: trivial replace
1783− [%b p=udal] :: atomic indel
1784− [%c p=(urge)] :: list indel
1785− [%d p=upas q=upas] :: tree edit
1786− == ::
1787− == ::
1788−
1789−See `%clay` doc
1790−
1791------------------------------------------------------------------------
57------------------------------------------------------------------------
1792
58
1793−### `++umph`
1794−
1795− ++ umph :: change filter
1796− $| $? %a :: no filter
1797− %b :: jamfile
1798− %c :: LF text
1799− == ::
1800− $% [%d p=@ud] :: blocklist
1801− == ::
1802−
1803−See `%clay` doc
1804
59
1805------------------------------------------------------------------------
60------------------------------------------------------------------------
1806
61
1807−### `++unce`
1808−
1809− ++ unce |* a=_,* :: change part
1810− $% [%& p=@ud] :: skip[copy]
1811− [%| p=(list a) q=(list a)] :: p -> q[chunk]
1812− == ::
1813−
1814−See `%clay` doc
1815−
1816------------------------------------------------------------------------
62------------------------------------------------------------------------
1817
63
1818−### `++unit`
1819−
1820−Maybe
1821−
1822−[mold]() generator. A `++unit` is either `~` or `[~ u=a]` where `a` is the
1823−type that was passed in.
1824−
1825−
1826−Source
1827−------
1828−
1829− ++ unit |* a=_,* :: maybe
1830−
1831−Examples
1832−--------
1833−
1834−See also: [`++bind`]()
1835−
1836− ~zod/try=> :type; *(unit time)
1837− ~
1838− u(@da)
1839− ~zod/try=> `(unit time)`[~ -<-]
1840− [~ ~2014.9.24..19.25.10..7dd5]
1841−
1842------------------------------------------------------------------------
64------------------------------------------------------------------------
1843
65
1844−### `++upas`
1845−
1846− ++ upas :: tree change (%d)
1847− $& [p=upas q=upas] :: cell
1848− $% [%0 p=axis] :: copy old
1849− [%1 p=*] :: insert new
1850− [%2 p=axis q=udon] :: mutate!
1851− == ::
1852−
1853−See `%clay` doc
1854−
1855------------------------------------------------------------------------
66------------------------------------------------------------------------
1856
67
1857−### `++urge`
1858−
1859− ++ urge |*(a=_,* (list (unce a))) :: list change
1860−
1861−See `%clay` doc
1862−
1863------------------------------------------------------------------------
68------------------------------------------------------------------------
1864
69
1865−### `++vase`
1866−
1867−Typed data. A `++vase` is used wherever typed data is explicitly worked
1868−with.
1869−
1870−
1871−Source
1872−------
1873−
1874− ++ vase ,[p=type q=*] :: type-value pair
1875−
1876−Examples
1877−--------
1878−See `%arvo` doc
1879−
1880− ~zod/try=> `vase`!>(~)
1881− [p=[%cube p=0 q=[%atom p=%n]] q=0]
1882−
1883------------------------------------------------------------------------
70------------------------------------------------------------------------
1884
71
1885−### `++vise`
1886−
1887−Convert during reboot
1888−
1889−Used to convert from previously-typed data during reboot.
1890−
1891−Source
1892−------
1893−
1894− ++ vise ,[p=typo q=*] :: old vase
1895−
1896−Examples
1897−--------
1898−
1899−See also: [`++typo`](), [`++seer`]()
1900−
1901------------------------------------------------------------------------
72------------------------------------------------------------------------
1902
73
1903−### `++wall`
1904−
1905−List of lines
1906−
1907−
1908−A `++wall` is used instead of a single [`++tape`]() with
1909−`\n`.
1910−
1911−Source
1912−------
1913−
1914− ++ wall (list tape) :: text lines (no \n)
1915−
1916−Examples
1917−--------
1918−
1919−See also: [`++wash`]()
1920−
1921− ~zod/try=> `wall`(wash [0 20] leaf/<(bex 256)>)
1922− <<
1923− "\/115.792.089.237.\/"
1924− " 316.195.423.570."
1925− " 985.008.687.907."
1926− " 853.269.984.665."
1927− " 640.564.039.457."
1928− " 584.007.913.129."
1929− " 639.936"
1930− "\/ \/"
1931− >>
1932−
1933------------------------------------------------------------------------
74------------------------------------------------------------------------
1934
75
1935−### `++wain`
1936−
1937− ++ wain (list cord) :: text lines (no \n)
1938−
1939−A list of lines. A `++wain` is used instead of a single [`++cord`]() with
1940−`\n`.
1941−
1942−See also: [`++lore`](), [`++role`]()
1943−
1944− ~zod/try=> `wain`/som/del/rok
1945− <|som del rok|>
1946− ~zod/try=> `wain`(lore ^:@t/=main=/bin/tree/hoon)
1947− <|
1948− !:
1949− :: /===/bin/tree/hoon
1950− |= ^
1951− |= [pax=path fla=$|(~ [%full ~])]
1952− =- ~[te/-]~
1953− =+ len=(lent pax)
1954− =+ rend=?~(fla |=(a=path +:(spud (slag len a))) spud)
1955− |- ^- wain
1956− =+ ark=;;(arch .^(cy/pax))
1957− =- ?~ q.ark -
1958− [(crip (rend pax)) -]
1959− %- zing
1960− %- turn :_ |=(a=@t ^$(pax (weld pax `path`/[a])))
1961− %- sort :_ aor
1962− %- turn :_ |=([a=@t ~] a)
1963− (~(tap by r.ark))
1964− |>
1965−
1966------------------------------------------------------------------------
76------------------------------------------------------------------------
1967
77
1968−### `++wing`
78+------------------------------------------------------------------------
1969−
1970− ++ wing (list limb) ::
1971−
1972−Address in subject. A `++wing` is a path to a value in the subject. A
1973−term alone is the trivial case of a `++wing`.
1974−
1975−See also: `++twig`
1976
79
1977− ~zod/try=> (ream 'a.+.c')
80+------------------------------------------------------------------------
1978− [%cnzz p=~[%a [%.y p=3] %c]]
1979− ~zod/try=> (wing +:(ream 'a.+.c'))
1980− ~[%a [%.y p=3] %c]
1981
81
1982------------------------------------------------------------------------
82------------------------------------------------------------------------
1983
83
1984−### `++wine`
84+------------------------------------------------------------------------
1985
85
1986−Printable type
86+------------------------------------------------------------------------
1987
87
1988−Used for pretty printing.
88+------------------------------------------------------------------------
1989
89
1990−Source
90+------------------------------------------------------------------------
1991−------
1992
91
1993− ++ wine $| ?(%noun %path %tank %void %wall %wool %yarn)
92+------------------------------------------------------------------------
1994− [%list p=term q=wine] ::
1995− [%pear p=term q=@] ::
1996− [%pick p=(list wine)] ::
1997− [%plot p=(list wine)] ::
1998− [%stop p=@ud] ::
1999− [%tree p=term q=wine] ::
2000− [%unit p=term q=wine] ::
2001− == ::
2002−
2003−Examples
2004−--------
2005−
2006−See also: [`++calf`]()
2007−
2008− ~zod/try=> ~(dole ut p:!>(*@tas))
2009− [p={} q=[%atom p=%tas]]
2010− ~zod/try=> `wine`q:~(dole ut p:!>(*@tas))
2011− [%atom p=%tas]
2012−
2013− ~zod/try=> ~(dole ut p:!>(*path))
2014− [ p
2015− { [ p=1
2016− q
2017− [ %pick
2018− p
2019− ~[
2020− [%pear p=%n q=0]
2021− [%plot p=~[[%face p=%i q=[%atom p=%ta]] [%face p=%t q=[%stop p=1]]]]
2022− ]
2023− ]
2024− ]
2025− }
2026− q=%path
2027− ]
2028− ~zod/try=> `wine`q:~(dole ut p:!>(*path))
2029− %path
2030
93
2031− ~zod/try=> ~(dole ut p:!>(*(map time cord)))
2032− [ p
2033− { [ p=1
2034− q
2035− [ %pick
2036− p
2037− ~[
2038− [%pear p=%n q=0]
2039− [ %plot
2040− p
2041− ~[
2042− [ %face
2043− p=%n
2044− q
2045− [ %plot
2046− p=~[[%face p=%p q=[%atom p=%da]] [%face p=%q q=[%atom p=%t]]]
2047− ]
2048− ]
2049− [%face p=%l q=[%stop p=1]]
2050− [%face p=%r q=[%stop p=1]]
2051− ]
2052− ]
2053− ]
2054− ]
2055− ]
2056− }
2057− q
2058− [ %tree
2059− p=%nlr
2060− q=[%plot p=~[[%face p=%p q=[%atom p=%da]] [%face p=%q q=[%atom p=%t]]]]
2061− ]
2062− ]
2063− ~zod/try=> `wine`q:~(dole ut p:!>(*(map time cord)))
2064− [ %tree
2065− p=%nlr
2066− q=[%plot p=~[[%face p=%p q=[%atom p=%da]] [%face p=%q q=[%atom p=%t]]]]
2067− ]
2068
94
2069------------------------------------------------------------------------
95------------------------------------------------------------------------
2070
96
2071−### `++wonk`
97+------------------------------------------------------------------------
2072
98
2073−XX Not a model?
99+------------------------------------------------------------------------
2074
100
2075−Pull result out of a `++edge`, or crash if there's no result.
101+------------------------------------------------------------------------
2076
102
2077−Source
103+------------------------------------------------------------------------
2078−------
2079
104
2080− ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq)) ::
105+------------------------------------------------------------------------
2081
106
2082−Examples
107+------------------------------------------------------------------------
2083−--------
2084
108
2085−See also: [`++edge`]()
109+------------------------------------------------------------------------
2086
110
2087− ~zod/try=> (wide:vast [1 1] "(add 2 2)")
111+------------------------------------------------------------------------
2088− [ p=[p=1 q=10]
2089− q
2090− [ ~
2091− [ p=[%cnhp p=[%cnzz p=~[%add]] q=~[[%dtzy p=%ud q=2] [%dtzy p=%ud q=2]]]
2092− q=[p=[p=1 q=10] q=""]
2093− ]
2094− ]
2095− ]
2096− ~zod/try=> (wonk (wide:vast [1 1] "(add 2 2)"))
2097− [%cnhp p=[%cnzz p=~[%add]] q=~[[%dtzy p=%ud q=2] [%dtzy p=%ud q=2]]]
2098
112
2099------------------------------------------------------------------------
113------------------------------------------------------------------------
2100
114
2101−### `++map`
115+------------------------------------------------------------------------
2102
116
2103−Map
117+------------------------------------------------------------------------
2104
118
2105−[mold]() generator. A `++map` is a [treap](http://en.wikipedia.org/wiki/Treap) of
119+------------------------------------------------------------------------
2106−key, value pairs.
2107
120
121+------------------------------------------------------------------------
2108
122
2109−Source
123+------------------------------------------------------------------------
2110−------
2111
124
2112− ++ map |* [a=_,* b=_,*] :: associative tree
125+------------------------------------------------------------------------
2113
126
2114−Examples
127+------------------------------------------------------------------------
2115−--------
2116
128
2117−See also: [`++by`]()
129+------------------------------------------------------------------------
2118
130
2119− ~zod/try=> :type; *(map ,@t ,@u)
131+------------------------------------------------------------------------
2120− {}
2121− nlr([p=@t q=@u])
2122− ~zod/try=> `(map ,@ta ,@ud)`(mo (limo a/1 b/2 ~))
2123− {[p=~.a q=1] [p=~.b q=2]}
2124
132
2125------------------------------------------------------------------------
133------------------------------------------------------------------------
2126
134
2127−### `++qeu`
135+------------------------------------------------------------------------
2128
136
2129−Queue
137+------------------------------------------------------------------------
2130
138
2131−[mold]() generator. An ordered [treap](http://en.wikipedia.org/wiki/Treap) of
139+------------------------------------------------------------------------
2132−items.
2133
140
2134−Source
141+------------------------------------------------------------------------
2135−------
2136
142
2137− ++ qeu |* a=_,* :: queue
143+------------------------------------------------------------------------
2138− $|(~ [n=a l=(qeu a) r=(qeu a)]) ::
2139
144
2140−See also: [`++to`]()
145+------------------------------------------------------------------------
2141
146
2142−Examples
147+------------------------------------------------------------------------
2143−--------
2144
148
2145− ~zod/try=> (qeu time)
149+------------------------------------------------------------------------
2146− <1.qyo [* <1.sxx [a=<1.ebd [* <101.jzo 1.ypj %164>]> <101.jzo 1.ypj %164>]>]>
2147− ~zod/try=> (~(gas to *(qeu time)) [~2014.1.1 ~2014.1.2 ~])
2148− {~2014.1.2 ~2014.1.1}
2149
150
2150------------------------------------------------------------------------
151------------------------------------------------------------------------
2151
152
2152−### `++set`
153+------------------------------------------------------------------------
2153
154
2154−Set
155+------------------------------------------------------------------------
2155
156
2156−[mold]() generator. A `++set` is a
157+------------------------------------------------------------------------
2157−[treap](http://en.wikipedia.org/wiki/Treap) with unique values.
2158
158
2159−Source
159+------------------------------------------------------------------------
2160−------
2161
160
2162− ++ set |* a=_,* :: set
161+------------------------------------------------------------------------
2163− $|(~ [n=a l=(set a) r=(set a)]) ::
2164
162
2165−Examples
163+------------------------------------------------------------------------
2166−--------
2167
164
2168−See also: [`++in`]()
165+------------------------------------------------------------------------
2169
166
2170− ~zod/try=> (sa "abc")
167+------------------------------------------------------------------------
2171− {~~a ~~c ~~b}
2172− ~zod/try=> (~(put in (sa "abc")) %d)
2173− {~~d ~~a ~~c ~~b}
2174− ~zod/try=> (~(put in (sa "abc")) %a)
2175− {~~a ~~c ~~b}
2176
168
2177------------------------------------------------------------------------
169------------------------------------------------------------------------
2178
170
2179−### `++jar`
171+------------------------------------------------------------------------
2180
172
173+------------------------------------------------------------------------
2181
174
2182−Tile generator. A [`++jar`]() is a [`++map`]() of [`++list`]().
175+------------------------------------------------------------------------
2183
176
2184−Source
177+------------------------------------------------------------------------
2185−------
2186
178
2187− ++ jar |*([a=_,* b=_,*] (map a (list b))) :: map of lists
179+------------------------------------------------------------------------
2188
180
2189−Examples
181+------------------------------------------------------------------------
2190−--------
2191
182
2192−See also: [`++ja`](), [`++by`](), [`++map`](), [`++list`]()
183+------------------------------------------------------------------------
2193
184
2194− ~zod/try=> =a (limo [1 2 ~])
185+------------------------------------------------------------------------
2195− ~zod/try=> a
2196− [i=1 t=[i=2 t=~]]
2197− ~zod/try=> =b (limo [3 4 ~])
2198− ~zod/try=> b
2199− [i=3 t=[i=4 t=~]]
2200− ~zod/try=> =c (mo (limo [[%a a] [%b b] ~]))
2201− ~zod/try=> c
2202− {[p=%a q=[i=1 t=[i=2 t=~]]] [p=%b q=[i=3 t=[i=4 t=~]]]}
2203− ~zod/try=> (~(get ja c) %a)
2204− [i=1 t=[i=2 t=~]]
2205− ~zod/try=> (~(get ja c) %c)
2206− ~
2207
186
2208------------------------------------------------------------------------
187------------------------------------------------------------------------
2209
188
2210−### `++jug`
189+------------------------------------------------------------------------
2211
190
191+------------------------------------------------------------------------
2212
192
2213−[mold]() generator. A `++jug` is a [`++map`]() of [`++set`]()s.
193+------------------------------------------------------------------------
2214
194
2215−Source
195+------------------------------------------------------------------------
2216−------
2217
196
2218− ++ jug |*([a=_,* b=_,*] (map a (set b))) :: map of sets
197+------------------------------------------------------------------------
2219
198
2220−Examples
199+------------------------------------------------------------------------
2221−--------
2222
200
2223−See also: `++ju`, `++by`, `++map`, `++set`
201+------------------------------------------------------------------------
2224
202
2225− ~zod/try=> =a (sa (limo [1 2 ~]))
203+------------------------------------------------------------------------
2226− ~zod/try=> a
2227− {1 2}
2228− ~zod/try=> =b (sa (limo [3 4 ~]))
2229− ~zod/try=> b
2230− {4 3}
2231− ~zod/try=> =c (mo (limo [[%a a] [%b b] ~]))
2232− ~zod/try=> c
2233− {[p=%a q={1 2}] [p=%b q={4 3}]}
2234− ~zod/try=> (~(get ju c) %b)
2235− {4 3}
2236− ~zod/try=> (~(put ju c) [%b 5])
2237− {[p=%a q={1 2}] [p=%b q={5 4 3}]}
2238
204
2239------------------------------------------------------------------------
205------------------------------------------------------------------------
2240
206
2241−</div>
207+</div>
docs/system/hoon/library/2a.md−642
@@ -1,678 +1,36 @@
12a basic unsigned math
12a basic unsigned math
2======================
2======================
3
3
4−### `++add`
5−
6−Add
7−
8−Produces the sum of `a` and `b`.
9−
10−Accepts
11−-------
12−
13−`a` is an [atom]().
14−
15−`b` is an atom.
16−
17−Produces
18−--------
19−
20−An atom.
21−
22−Source
23−------
24−
25− ++ add :: add
26− ~/ %add
27− |= [a=@ b=@]
28− ^- @
29− ?: =(0 a) b
30− $(a (dec a), b +(b))
31−
32−Examples
33−--------
34−
35− ~zod/try=> (add 2 2)
36− 4
37− ~zod/try=> (add 1 1.000.000)
38− 1.000.001
39− ~zod/try=> (add 1.333 (mul 2 2))
40− 1.337
41−
42------------------------------------------------------------------------
4------------------------------------------------------------------------
43
5
44−### `++cap`
45−
46−Tree head
47−
48−Tests whether an `a` is in the head or tail of a [noun](). Produces the
49−[cube]() `%2` if it is within the head, or the cube `%3` if it is
50−within the tail.
51−
52−Accepts
53−-------
54−
55−`a` is an atom.
56−
57−Produces
58−--------
59−
60−A [cube]().
61−
62−Source
63−------
64−
65− ++ cap :: tree head
66− ~/ %cap
67− |= a=@
68− ^- ?(%2 %3)
69− ?- a
70− %2 %2
71− %3 %3
72− ?(%0 %1) !!
73− * $(a (div a 2))
74− ==
75− ::
76−
77−Examples
78−--------
79−
80− ~zod/try=> (cap 4)
81− %2
82− ~zod/try=> (cap 6)
83− %3
84− ~zod/try=> (cap (add 10 9))
85− %2
86−
87------------------------------------------------------------------------
6------------------------------------------------------------------------
88
7
89−### `++dec`
90−
91−Decrement
92−
93−Decrements `a` by `1`.
94−
95−Accepts
96−-------
97−
98−`a` is an [atom]().
99−
100−Produces
101−--------
102−
103−An atom.
104−
105−Source
106−------
107−
108− ++ dec :: decrement
109− ~/ %dec
110− |= a=@
111− ~| %decrement-underflow
112− ?< =(0 a)
113− =+ b=0
114− |- ^- @
115− ?: =(a +(b)) b
116− $(b +(b))
117− ::
118−
119−Examples
120−--------
121−
122− ~zod/try=> (dec 7)
123− 6
124− ~zod/try=> (dec 0)
125− ! decrement-underflow
126− ! exit
127−
128------------------------------------------------------------------------
8------------------------------------------------------------------------
129
9
130−### `++div`
131−
132−Divide
133−
134−Computes `a` divided by `b`.
135−
136−Accepts
137−-------
138−
139−`a` is an [atom]().
140−
141−`b` is an [atom]().
142−
143−Produces
144−--------
145−
146−An atom.
147−
148−Source
149−------
150−
151− ++ div :: divide
152− ~/ %div
153− |= [a=@ b=@]
154− ^- @
155− ~| 'div'
156− ?< =(0 b)
157− =+ c=0
158− |-
159− ?: (lth a b) c
160− $(a (sub a b), c +(c))
161− ::
162−
163−Examples
164−--------
165−
166− ~zod/try=> (div 4 2)
167− 2
168− ~zod/try=> (div 17 8)
169− 2
170− ~zod/try=> (div 20 30)
171− 0
172
10
173------------------------------------------------------------------------
11------------------------------------------------------------------------
174
12
175−### `++fac`
176−
177−Factorial
178−
179−Computes the factorial of `a`.
180−
181−Accepts
182−-------
183−
184−`a` is an [atom]().
185−
186−Produces
187−--------
188−
189−An atom.
190−
191−Source
192−------
193−
194− ++ fac :: factorial
195− ~/ %fac
196− |= a=@
197− ^- @
198− ?: =(0 a) 1
199− (mul a $(a (dec a)))
200− ::
201−
202−Examples
203−--------
204−
205− ~zod/try=> (fac 3)
206− 6
207− ~zod/try=> (fac 0)
208− 1
209− ~zod/try=> (fac 11)
210− 39.916.800
211−
212------------------------------------------------------------------------
13------------------------------------------------------------------------
213
14
214−### `++gte`
215−
216−Greater-than/equal
217−
218−Tests whether `a` is greater than a number `b`.
219−
220−Accepts
221−-------
222−
223−`a` is an [atom]().
224−
225−`b` is an atom.
226−
227−Produces
228−--------
229−
230−A boolean.
231−
232−Source
233−------
234−
235− ++ gte :: greater-equal
236− ~/ %gte
237− |= [a=@ b=@]
238− ^- ?
239− !(lth a b)
240− ::
241−
242−Examples
243−--------
244−
245− ~zod/try=> (gte 100 10)
246− %.y
247− ~zod/try=> (gte 4 4)
248− %.y
249− ~zod/try=> (gte 3 4)
250− %.n
251−
252------------------------------------------------------------------------
15------------------------------------------------------------------------
253
16
254−### `++gth`
255−
256−Greater-than
257−
258−Tests whether `a` is greater than `b`.
259−
260−Accepts
261−-------
262−
263−`a` is an [atom]().
264−
265−`b` is an atom.
266−
267−Produces
268−--------
269−
270−A boolean.
271−
272−Source
273−------
274−
275− ++ gth :: greater-than
276− ~/ %gth
277− |= [a=@ b=@]
278− ^- ?
279− !(lte a b)
280− ::
281−
282−Examples
283−--------
284−
285− ~zod/try=> (gth 'd' 'c')
286− %.y
287− ~zod/try=> (gth ~h1 ~m61)
288− %.n
289−
290------------------------------------------------------------------------
17------------------------------------------------------------------------
291
18
292−### `++lte`
293−
294−Less-than/equal
295−
296−Tests whether `a` is less than or equal to `b`.
297−
298−Accepts
299−-------
300−
301−`a` is an [atom]().
302−
303−`b` is an atom.
304−
305−Produces
306−--------
307−
308−A boolean.
309−
310−Source
311−------
312−
313− ++ lte :: less-equal
314− ~/ %lte
315− |= [a=@ b=@]
316− |(=(a b) (lth a b))
317− ::
318−
319−Examples
320−--------
321−
322− ~zod/try=> (lte 4 5)
323− %.y
324− ~zod/try=> (lte 5 4)
325− %.n
326− ~zod/try=> (lte 5 5)
327− %.y
328− ~zod/try=> (lte 0 0)
329− %.y
330−
331------------------------------------------------------------------------
19------------------------------------------------------------------------
332
20
333−### `++lth`
334−
335−Less-than
336−
337−Tests whether `a` is less than `b`.
338−
339−Accepts
340−-------
341−
342−`a` is an [atom]().
343−
344−`b` is an atom.
345−
346−Produces
347−--------
348−
349−A boolean.
350−
351−Source
352−------
353−
354− ++ lth :: less-than
355− ~/ %lth
356− |= [a=@ b=@]
357− ^- ?
358− ?& !=(a b)
359− |-
360− ?| =(0 a)
361− ?& !=(0 b)
362− $(a (dec a), b (dec b))
363− == == ==
364− ::
365−
366−Examples
367−--------
368−
369− ~zod/try=> (lth 4 5)
370− %.y
371− ~zod/try=> (lth 5 4)
372− %.n
373− ~zod/try=> (lth 5 5)
374− %.n
375− ~zod/try=> (lth 5 0)
376− %.n
377
21
378------------------------------------------------------------------------
22------------------------------------------------------------------------
379
23
380−### `++mas`
381−
382−Axis within head/tail?
383−
384−Computes the axis of `a` within either the head or tail of a noun (depends whether `a` lies within the the head or tail).
385−
386−Accepts
387−-------
388−
389−`a` is an [atom]().
390−
391−Produces
392−--------
393−
394−An atom.
395−
396−Source
397−------
398−
399− ++ mas :: tree body
400− ~/ %mas
401− |= a=@
402− ^- @
403− ?- a
404− 1 !!
405− 2 1
406− 3 1
407− * (add (mod a 2) (mul $(a (div a 2)) 2))
408− ==
409− ::
410−
411−Examples
412−--------
413−
414− ~zod/try=> (mas 3)
415− 1
416− ~zod/try=> (mas 4)
417− 2
418− ~zod/try=> (mas 5)
419− 3
420− ~zod/try=> (mas 6)
421− 2
422− ~zod/try=> (mas 0)
423− ! exit
424− ~zod/try=> (mas 1)
425− ! exit
426−
427-----------------------------------------------------------------------
24-----------------------------------------------------------------------
428
25
429−### `++max`
430−
431−Maximum
432−
433−Computes the greater of `a` and `b`.
434−
435−Accepts
436−-------
437−
438−`a` is an [atom]().
439−
440−`b` is an atom.
441−
442−Produces
443−--------
444−
445−An atom.
446−
447−Source
448−------
449−
450− ++ max :: maximum
451− ~/ %max
452− |= [a=@ b=@]
453− ^- @
454− ?: (gth a b) a
455− b
456− ::
457−
458−Examples
459−--------
460−
461− ~zod/try=> (max 10 100)
462− 100
463− ~zod/try=> (max 10.443 9)
464− 10.443
465− ~zod/try=> (max 0 1)
466− 1
467−
468------------------------------------------------------------------------
26------------------------------------------------------------------------
469
27
470−### `++min`
471−
472−Minimum
473−
474−Computes the lesser of `a` and `b`.
475−
476−Accepts
477−-------
478−
479−`a` is an [atom]().
480−
481−`b` is an atom.
482−
483−Produces
484−--------
485−
486−An atom.
487−
488−Source
489−------
490−
491− ++ min :: minimum
492− ~/ %min
493− |= [a=@ b=@]
494− ^- @
495− ?: (lth a b) a
496− b
497− ::
498−
499−Examples
500−--------
501−
502− ~zod/try=> (min 10 100)
503− 10
504− ~zod/try=> (min 10.443 9)
505− 9
506− ~zod/try=> (min 0 1)
507− 0
508−
509------------------------------------------------------------------------
28------------------------------------------------------------------------
510
29
511−### `++mod`
512−
513−Modulus
514−
515−Computes the remainder of dividing `a` by `b`.
516−
517−Accepts
518−-------
519−
520−`a` is an [atom]().
521−
522−`b` is an atom.
523−
524−Produces
525−--------
526−
527−An atom.
528−
529−Source
530−------
531−
532− ++ mod :: remainder
533− ~/ %mod
534− |= [a=@ b=@]
535− ^- @
536− ?< =(0 b)
537− (sub a (mul b (div a b)))
538− ::
539−
540−Examples
541−--------
542−
543− ~zod/try=> (mod 5 2)
544− 1
545− ~zod/try=> (mod 5 5)
546− 0
547−
548------------------------------------------------------------------------
30------------------------------------------------------------------------
549
31
550−### `++mul`
551−
552−Multiply
553−
554−Multiplies `a` by `b`.
555−
556−Accepts
557−-------
558−
559−`a` is an [atom]().
560−
561−`b` is an atom.
562−
563−Produces
564−--------
565−
566−An atom.
567−
568−Source
569−------
570−
571− ++ mul :: multiply
572− ~/ %mul
573− |= [a=@ b=@]
574− ^- @
575− =+ c=0
576− |-
577− ?: =(0 a) c
578− $(a (dec a), c (add b c))
579− ::
580−
581−Examples
582−--------
583−
584− ~zod/try=> (mul 3 4)
585− 12
586− ~zod/try=> (mul 0 1)
587− 0
588−
589------------------------------------------------------------------------
32------------------------------------------------------------------------
590
33
591−### `++peg`
592−
593−Axis within axis
594−
595−Computes the axis of `b` within axis `a`.
596−
597−Accepts
598−-------
599−
600−`a` is an [atom]().
601−
602−`b` is an atom.
603−
604−Produces
605−--------
606−
607−An atom.
608−
609−Source
610−------
611−
612− ++ peg :: tree connect
613− ~/ %peg
614− |= [a=@ b=@]
615− ^- @
616− ?- b
617− 1 a
618− 2 (mul a 2)
619− 3 +((mul a 2))
620− * (add (mod b 2) (mul $(b (div b 2)) 2))
621− ==
622− ::
623−
624−Examples
625−--------
626−
627− ~zod/try=> (peg 4 1)
628− 4
629− ~zod/try=> (peg 4 2)
630− 8
631− ~zod/try=> (peg 8 45)
632− 269
633−
634------------------------------------------------------------------------
34------------------------------------------------------------------------
635
35
636−### `++sub`
637−
638−Subtract
639−
640−Subtracts `b` from `a`.
641−
642−Accepts
643−-------
644−
645−`a` is an [atom]().
646−
647−`b` is an [atom]().
648−
649−Produces
650−--------
651−
652−An atom.
653−
654−Source
655−------
656−
657− ++ sub :: subtract
658− ~/ %sub
659− |= [a=@ b=@]
660− ~| %subtract-underflow
661− ^- @
662− ?: =(0 b) a
663− $(a (dec a), b (dec b))
664−
665−Examples
666−--------
667−
668− ~zod/try=> (sub 10 5)
669− 5
670− ~zod/try=> (sub 243 44)
671− 199
672− ~zod/try=> (sub 5 0)
673− 5
674− ~zod/try=> (sub 0 5)
675− ! subtract-underflow
676− ! exit
677−
678------------------------------------------------------------------------
36------------------------------------------------------------------------
docs/system/hoon/library/2b.md−1247
@@ -4,1317 +4,70 @@
4Section 2bA, units
4Section 2bA, units
5------------------
5------------------
6
6
7−### `++biff`
8−
9−Unit as argument
10−
11−Applies a function `b` that produces a unit to the unwrapped value of [++unit]()
12−`a` (`u.a`). If `a` is empty, `~` is produced.
13−
14−Accepts
15−-------
16−
17−`a` is a unit.
18−
19−`b` is a function that accepts a noun and produces a unit.
20−
21−Produces
22−--------
23−
24−A unit.
25−
26−Source
27−------
28−
29− ++ biff :: apply
30− |* [a=(unit) b=$+(* (unit))]
31− ?~ a ~
32− (b u.a)
33−
34−Examples
35−--------
36−
37− ~zod/try=> (biff (some 5) |=(a=@ (some (add a 2))))
38− [~ u=7]
39− ~zod/try=> (biff ~ |=(a=@ (some (add a 2))))
40− ~
41−
42------------------------------------------------------------------------
7------------------------------------------------------------------------
43
8
44−### `++bind`
45−
46−Non-unit function to unit, producing unit
47−
48−Applies a function `b` to the value (`u.a`) of a [++unit]() `a`, producing
49−a unit. Used when you want a function that does not accept or produce a
50−unit to both accept and produce a unit.
51−
52−Accepts
53−-------
54−
55−`a` is a unit.
56−
57−`b` is a function.
58−
59−Produces
60−--------
61−
62−A unit.
63−
64−Source
65−------
66−
67− ++ bind :: argue
68− |* [a=(unit) b=gate]
69− ?~ a ~
70− [~ u=(b u.a)]
71−
72−Examples
73−--------
74−
75− ~zod/try=> (bind ((unit ,@) [~ 97]) ,@t)
76− [~ `a`]
77− ~zod/try=> =a |=(a=@ (add a 1))
78− ~zod/try=> (bind ((unit ,@) [~ 2]) a)
79− [~ 3]
80−
81------------------------------------------------------------------------
9------------------------------------------------------------------------
82
10
83−### `++bond`
84−
85−Replace null
86−
87−Replaces an empty [++unit]() `b` with the product of a called [trap]()
88−`a`. If the unit is not empty, then the original unit is produced.
89−
90−Accepts
91−-------
92−
93−`a` is a trap.
94−
95−`b` is a unit.
96−
97−Produces
98−--------
99−
100−Either the product of `a` or the value inside of unit `b`.
101−
102−Source
103−------
104−
105− ++ bond :: replace
106− |* a=trap
107− |* b=(unit)
108− ?~ b $:a
109− u.b
110−
111−Examples
112−--------
113−
114− ~zod/try=> (bex 10)
115− 1.024
116− ~zod/try=> ((bond |.((bex 10))) ~)
117− 1.024
118− ~zod/try=> ((bond |.((bex 10))) (slaw %ud '123'))
119− 123
120−
121------------------------------------------------------------------------
11------------------------------------------------------------------------
122
12
123−### `++both`
124−
125−Group unit values into pair
126−
127−Produces `~` if either `a` or `b` are empty. Otherwise, produces a
128−[++unit]() whose value is a cell of the values of two input units `a` and
129−`b`.
130−
131−Accepts
132−-------
133−
134−`a` is a unit.
135−
136−`b` is a unit.
137−
138−Produces
139−--------
140−
141−A unit of the two initial values.
142−
143−Source
144−------
145−
146− ++ both :: all the above
147− |* [a=(unit) b=(unit)]
148− ?~ a ~
149− ?~ b ~
150− [~ u=[u.a u.b]]
151−
152−Examples
153−--------
154−
155− ~zod/try=> (both (some 1) (some %b))
156− [~ u=[1 %b]]
157− ~zod/try=> (both ~ (some %b))
158− ~
159
13
160------------------------------------------------------------------------
14------------------------------------------------------------------------
161
15
162−### `++clap`
163−
164−Apply function to two units
165−
166−Applies a binary function `c`--which does not usually accept or produce a [`++unit`]()--
167−to the values of two units, `a` and `b`, producing a unit.
168−
169−Accepts
170−-------
171−
172−`a` is a unit.
173−
174−`b` is a unit.
175−
176−`c` is a function that performs a binary operation.
177−
178−Produces
179−--------
180−
181−A unit.
182−
183−Source
184−------
185−
186− ++ clap :: combine
187− |* [a=(unit) b=(unit) c=_|=(^ +<-)]
188− ?~ a b
189− ?~ b a
190− [~ u=(c u.a u.b)]
191−
192−Examples
193−--------
194−
195− ~zod/try=> =u ((unit ,@t) [~ 'a'])
196− ~zod/try=> =v ((unit ,@t) [~ 'b'])
197− ~zod/try=> (clap u v |=([a=@t b=@t] (welp (trip a) (trip b))))
198− [~ u="ab"]
199− ~zod/try=> =a ((unit ,@u) [~ 1])
200− ~zod/try=> =b ((unit ,@u) [~ 2])
201− ~zod/try=> =c |=([a=@ b=@] (add a b))
202− ~zod/try=> (clap a b c)
203− [~ 3]
204−
205
16
206------------------------------------------------------------------------
17------------------------------------------------------------------------
207
18
208−### `++drop`
209−
210−Unit to list
211−
212−Makes a [++list]() of the unwrapped value (`u.a`) of a [`++unit`]() `a`.
213−
214−Accepts
215−-------
216−
217−`a` is a unit.
218−
219−Produces
220−--------
221−
222−A list.
223−
224−Source
225−------
226−
227− ++ drop :: enlist
228− |* a=(unit)
229− ?~ a ~
230− [i=u.a t=~]
231−
232−Examples
233−--------
234−
235− ~zod/try=> =a ((unit ,@) [~ 97])
236− ~zod/try=> (drop a)
237− [i=97 t=~]
238− ~zod/try=> =a ((unit ,@) [~])
239− ~zod/try=> (drop a)
240− ~
241−
242------------------------------------------------------------------------
19------------------------------------------------------------------------
243
20
244−### `++fall`
245−
246−Give unit a default value
247−
248−Produces a default value `b` for a [`++unit`]() `a` in cases where `a` is null.
249−
250−Accepts
251−-------
252−
253−`a` is a unit.
254−
255−`b` is a [noun]() that's used as the default value.
256−
257−Produces
258−--------
259−
260−Either a noun `b` or the unwrapped value of unit `a`.
261−
262−Source
263−------
264−
265− ++ fall :: default
266− |* [a=(unit) b=*]
267− ?~(a b u.a)
268−
269−Examples
270−--------
271−
272− ~zod/try=> (fall ~ `a`)
273− `a`
274− ~zod/try=> (fall [~ u=0] `a`)
275− 0
276−
277------------------------------------------------------------------------
21------------------------------------------------------------------------
278
22
279−### `++lift`
280−
281−Curried bind
282−
283−Accepts a [`++gate`]() `a` and produces a function that accepts [`++unit`]()
284−`b` to which it applies `a`. Used when you want a function that does not accept
285−or produce a unit to both accept and produce a unit.
286−
287−Accepts
288−-------
289−
290−`a` is a gate.
291−
292−`b` is a unit.
293−
294−Produces
295−--------
296−
297−A unit.
298−
299−Source
300−------
301−
302− ++ lift :: lift gate (fmap)
303− |* a=gate :: flipped
304− |* b=(unit) :: curried
305− (bind b a) :: bind
306−
307−Examples
308−--------
309−
310− ~zod/try=> ((lift dec) `(unit ,@)`~)
311− ~
312− ~zod/try=> ((lift dec) `(unit ,@)`[~ 20])
313− [~ 19]
314−
315------------------------------------------------------------------------
23------------------------------------------------------------------------
316
24
317−### `++mate`
318−
319−Choose
320−
321−Accepts two units `a` and `b` whose values are expected to be
322−equivalent. If either is empty, then the value of the other is produced.
323−If neither are empty, it asserts that both values are the same and
324−produces that value. If the assertion fails, `++mate` crashes with
325−`'mate'` in the stack trace.
326−
327−Accepts
328−-------
329−
330−`a` is a unit.
331−
332−`b` is a unit.
333−
334−Produces
335−--------
336−
337−A unit or crash.
338−
339−Source
340−------
341−
342−++ mate :: choose
343− |* [a=(unit) b=(unit)]
344− ?~ b a
345− ?~ a b
346− ?.(=(u.a u.b) ~|('mate' !!) a)
347−
348−Examples
349−--------
350−
351− ~zod/try=> =a ((unit ,@) [~ 97])
352− ~zod/try=> =b ((unit ,@) [~ 97])
353− ~zod/try=> (mate a b)
354− [~ 97]
355− ~zod/try=> =a ((unit ,@) [~ 97])
356− ~zod/try=> =b ((unit ,@) [~])
357− ~zod/try=> (mate a b)
358− [~ 97]
359− ~zod/try=> =a ((unit ,@) [~ 97])
360− ~zod/try=> =b ((unit ,@) [~ 98])
361− ~zod/try=> (mate a b)
362− ! 'mate'
363− ! exit
364−
365------------------------------------------------------------------------
25------------------------------------------------------------------------
366
26
367−### `++need`
368−
369−Unwrap unit
370−
371−Retrieve the value from a [`++unit`]() and crash if the unit is null.
372−
373−Accepts
374−-------
375−
376−`a` is a unit.
377−
378−Produces
379−--------
380−
381−Either the unwrapped value of `a` (`u.a`), or crash.
382−
383−Source
384−------
385−
386− ++ need :: demand
387− |* a=(unit)
388− ?~ a !!
389− u.a
390−
391−Examples
392−--------
393−
394− ~zod/try=> =a ((unit ,[@t @t]) [~ ['a' 'b']])
395− ~zod/try=> (need a)
396− ['a' 'b']
397− ~zod/try=> =a ((unit ,@ud) [~ 17])
398− ~zod/try=> (need a)
399− 17
400− ~zod/try=> =a ((unit ,@) [~])
401− ~zod/try=> (need a)
402− ! exit
403−
404------------------------------------------------------------------------
27------------------------------------------------------------------------
405
28
406−### `++some`
407−
408−Wrap value in a unit
409−
410−Takes any atom `a` and produces a [`++unit`]() with the value set to `a`.
411−
412−Accepts
413−-------
414−
415−`a` is a [noun]().
416−
417−Produces
418−--------
419−
420−A unit.
421−
422−Source
423−------
424−
425− ++ some :: lift (pure)
426− |* a=*
427− [~ u=a]
428−
429−Examples
430−--------
431−
432− ~zod/try=> (some [`a` `b`])
433− [~ u=[`a` `b`]]
434− ~zod/try=> (some &)
435− [~ u=%.y]
436−
437------------------------------------------------------------------------
29------------------------------------------------------------------------
438
30
439section 2bB, lists
31section 2bB, lists
440------------------
32------------------
441
33
442−Reverse
443−
444−### `++flop`
445−
446−Produces the list `a` in reverse order.
447−
448−Accepts
449−-------
450−
451−`a` is a list.
452−
453−Produces
454−--------
455−
456−A list.
457−
458−Source
459−------
460−
461− ++ flop :: reverse
462− ~/ %flop
463− |* a=(list)
464− => .(a (homo a))
465− ^+ a
466− =+ b=`_a`~
467− |-
468− ?~ a b
469− $(a t.a, b [i.a b])
470−
471−
472−Examples
473−--------
474−
475− ~zod/try=> =a (limo [1 2 3 ~])
476− ~zod/try=> (flop a)
477− ~[3 2 1]
478−
479−### `++homo`
480−
481−Homogenize
482−
483−Produces a [`++list`]() whose type is a fork of all the contained types in the
484−list `a`. Used when you want to make all the types of the elements of a list the same.
485−
486−Accepts
487−-------
488−
489−`a` is a list.
490−
491−Produces
492−--------
493−
494−a list.
495−
496−Source
497−------
498−
499− ++ homo :: homogenize
500− |* a=(list)
501− ^+ =< $
502− |% +- $ ?:(_? ~ [i=(snag 0 a) t=$])
503− --
504− a
505−
506−Examples
507−--------
508−
509− ~zod/try=> lyst
510− [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]]
511− ~zod/try=> (homo lyst)
512− ~[1 97 2 98 [~ u=10]]
513− ~zod/try=> =a (limo [1 2 3 ~])
514− ~zod/try=> a
515− [i=1 t=[i=2 t=[i=3 t=~]]]
516− ~zod/try=> (homo a)
517− ~[1 2 3]
518−
519−### `++limo`
520−
521−List Constructor
522−
523−Turns a null-terminated tuple into a [`++list`]().
524−
525−Accepts
526−-------
527−
528−`a` is a null-terminated tuple.
529−
530−Produces
531−--------
532−
533−A list
534−
535−Source
536−------
537−
538− ++ limo :: listify
539− |* a=*
540− ^+ =< $
541− |% +- $ ?~(a ~ ?:(_? i=-.a t=$ $(a +.a)))
542− --
543− a
544−
545−Examples
546−--------
547−
548− ~zod/try=> (limo [1 2 3 ~])
549− [i=1 t=[i=2 t=[i=3 t=~]]]
550−
551----------------------------------------------------------------------
34----------------------------------------------------------------------
552
35
553−### `++lent`
554−
555−List length
556−
557−Produces the length of any [`++list`]() `a` as an atom.
558−
559−Accepts
560−-------
561−
562−`a` is a list.
563−
564−Produces
565−--------
566−
567−an atom.
568−
569−Source
570−------
571−
572− ++ lent :: length
573− ~/ %lent
574− |= a=(list)
575− ^- @
576− =+ b=0
577− |-
578− ?~ a b
579− $(a t.a, b +(b))
580−
581−Examples
582−--------
583−
584− ~zod/try=> (lent (limo [1 2 3 4 ~]))
585− 4
586− ~zod/try=> (lent (limo [1 'a' 2 'b' (some 10) ~]))
587− 5
588−
589------------------------------------------------------------------------
36------------------------------------------------------------------------
590
37
591−### `++levy`
592−
593−Logical "and" on list
594−
595−Computes the Boolean logical "and" on the results of [gate]() `b` applied to each individual element in [`++list`]() `a`.
596−
597−Accepts
598−-------
599−
600−`a` is a list.
601−
602−`b` is a gate.
603−
604−Produces
605−--------
606−
607−Source
608−------
609−
610− ++ levy
611− ~/ %levy :: all of
612− |* [a=(list) b=_|=(p=* .?(p))]
613− |- ^- ?
614− ?~ a &
615− ?. (b i.a) |
616− $(a t.a)
617−
618−Examples
619−--------
620−
621− ~zod/try=> =a |=(a=@ (lte a 1))
622− ~zod/try=> (levy (limo [0 1 2 1 ~]) a)
623− %.n
624− ~zod/try=> =a |=(a=@ (lte a 3))
625− ~zod/try=> (levy (limo [0 1 2 1 ~]) a)
626− %.y
627−
628------------------------------------------------------------------------
38------------------------------------------------------------------------
629
39
630−### `++lien`
631−
632−Logical "or" on list
633−
634− ++ lien :: some of
635− ~/ %lien
636− |* [a=(list) b=$+(* ?)]
637− |- ^- ?
638− ?~ a |
639− ?: (b i.a) &
640− $(a t.a)
641−
642−Computes the Boolean logical "or" on the results of applying [gate]() `b` to every element of [`++list`]() `a`.
643−
644−`a` is a list.
645−
646−`b` is a gate.
647−
648− ~zod/try=> =a |=(a=@ (gte a 1))
649− ~zod/try=> (lien (limo [0 1 2 1 ~]) a)
650− %.y
651− ~zod/try=> =a |=(a=@ (gte a 3))
652− ~zod/try=> (lien (limo [0 1 2 1 ~]) a)
653− %.n
654−
655------------------------------------------------------------------------
40------------------------------------------------------------------------
656
41
657−### `++murn`
658−
659−Maybe transform
660−
661−Passes each member of [`++list`]() `a` to [gate]() `b`, which must produce a
662−[`++unit`](). Produces a new list with all the results that do not produce
663−`~`.
664−
665−Accepts
666−-------
667−
668−`a` is a [list]().
669−
670−`b` is a [gate]() that produces a [unit]().
671−
672−Produces
673−--------
674−
675−A unit.
676−
677−Source
678−------
679−
680− ++ murn :: maybe transform
681− |* [a=(list) b=$+(* (unit))]
682− |-
683− ?~ a ~
684− =+ c=(b i.a)
685− ?~ c
686− $(a t.a)
687− [i=u.c t=$(a t.a)]
688−
689−Examples
690−--------
691−
692− ~zod/try=> =a |=(a=@ ?.((gte a 2) ~ (some (add a 10))))
693− ~zod/try=> (murn (limo [0 1 2 3 ~]) a)
694− [i=12 t=[i=13 t=~]]
695−
696-------------------------------------------------------------
42-------------------------------------------------------------
697
43
698−### `++reap`
699−
700−Replicate
701−
702−Replicate: produces a [`++list`]() containing `a` copies of `b`.
703−
704−Accepts
705−-------
706−
707−`b` is a [noun]()
708−
709−Produces
710−--------
711−
712−A list.
713−
714−Source
715−------
716−
717− ++ reap :: replicate
718− |* [a=@ b=*]
719− |- ^- (list ,_b)
720− ?~ a ~
721− [b $(a (dec a))]
722−
723−Examples
724−--------
725−
726− ~zod/try=> (reap 20 %a)
727− ~[%a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a]
728− ~zod/try=> (reap 5 ~s1)
729− ~[~s1 ~s1 ~s1 ~s1 ~s1]
730− ~zod/try=> `@dr`(roll (reap 5 ~s1) add)
731− ~s5
732−
733------------------------------------------------------------------------
44------------------------------------------------------------------------
734
45
735−### `++reel`
736−
737−Right fold
738−
739−Right fold: moves right to left across a [`++list`]() `a`, recursively slamming
740−a binary [gate]() `b` with an element from `a` and an accumulator, producing
741−the final value of the accumulator.
742−
743−Accepts
744−-------
745−
746−`b` is a binary gate.
747−
748−Produces
749−--------
750−
751−The accumulator, which is a [noun]().
752−
753−Source
754−------
755−
756− ++ reel :: right fold
757− ~/ %reel
758− |* [a=(list) b=_|=([* *] +<+)]
759− |- ^+ +<+.b
760− ?~ a
761− +<+.b
762− (b i.a $(a t.a))
763−
764−Examples
765−--------
766−
767− ~zod/try=> =sum =|([p=@ q=@] |.((add p q)))
768− ~zod/try=> (reel (limo [1 2 3 4 5 ~]) sum)
769− 15
770− ~zod/try=> =a =|([p=@ q=@] |.((sub p q)))
771− ~zod/try=> (reel (limo [6 3 1 ~]) a)
772− 4
773− ~zod/try=> (reel (limo [3 6 1 ~]) a)
774− ! subtract-underflow
775− ! exit
776−
777------------------------------------------------------------------------
46------------------------------------------------------------------------
778
47
779−### `++roll`
780−
781−Left fold
782−
783−Left fold: moves left to right across a list `a`, recursively slamming a
784−binary [gate]() `b` with an element from the [`++list`]() and an accumulator,
785−producing the final value of the accumulator.
786−
787−Accepts
788−-------
789−
790−`b` is a binary [gate]().
791−
792−Produces
793−--------
794−
795−The accumulator, which is a [noun]().
796−
797−Source
798−------
799−
800− ++ roll :: left fold
801− ~/ %roll
802− |* [a=(list) b=_|=([* *] +<+)]
803− |- ^+ +<+.b
804− ?~ a
805− +<+.b
806− $(a t.a, b b(+<+ (b i.a +<+.b)))
807−
808−Examples
809−--------
810−
811− ~zod/try=> =sum =|([p=@ q=@] |.((add p q)))
812− ~zod/try=> (roll (limo [1 2 3 4 5 ~]) sum)
813− q=15
814− ~zod/try=> =a =|([p=@ q=@] |.((sub p q)))
815− ~zod/try=> (roll (limo [6 3 1 ~]) a)
816− ! subtract-underflow
817− ! exit
818− ~zod/try=> (roll (limo [1 3 6 ~]) a)
819− q=4
820−
821------------------------------------------------------------------------
48------------------------------------------------------------------------
822
49
823−### `++skid`
824−
825−Separate
826−
827−Seperates a [`++list`]() `a` into two lists - Those elements of `a` who produce
828−true when slammed to [gate]() `b` and those who produce `%.n`.
829−
830−Accepts
831−-------
832−
833−`b` is a gate that accepts one argument and produces a loobean.
834−
835−Produces
836−--------
837−
838−A cell of two lists.
839−
840−Source
841−------
842−
843− ++ skid :: separate
844− |* [a=(list) b=$+(* ?)]
845− |- ^+ [p=a q=a]
846− ?~ a [~ ~]
847− =+ c=$(a t.a)
848− ?:((b i.a) [[i.a p.c] q.c] [p.c [i.a q.c]])
849−
850−
851−Examples
852−--------
853−
854− ~zod/try=> =a |=(a=@ (gth a 1))
855− ~zod/try=> (skid (limo [0 1 2 3 ~]) a)
856− [p=[i=2 t=[i=3 t=~]] q=[i=0 t=[i=1 t=~]]]
857−
858------------------------------------------------------------------------
50------------------------------------------------------------------------
859
51
860−### `++skim`
861−
862−Suffix
863−
864−Cycles through the members of a list `a`, passing them to a gate `b` and
865−producing a list of all of the members that produce `%.y`. Inverse of
866−`++skip`.
867−
868−Accepts
869−-------
870−
871−`b` is a [gate]() that accepts one argument and produces a loobean.
872−
873−Produces
874−--------
875−
876−Source
877−------
878−
879−++ skim :: only
880− ~/ %skim
881− |* [a=(list) b=_|=(p=* .?(p))]
882− |-
883− ^+ a`
884− ?~ a ~
885− ?:((b i.a) [i.a $(a t.a)] $(a t.a))
886−
887−Examples
888−--------
889−
890− ~zod/try=> =a |=(a=@ (gth a 1))
891− ~zod/try=> (skim (limo [0 1 2 3 ~]) a)
892− [i=2 t=[i=3 t=~]]
893−
894------------------------------------------------------------------------
52------------------------------------------------------------------------
895
53
896−### `++skip`
897−
898−Except
899−
900−Cycles through the members of [`++list`]() `a`, passing them to a [gate]() `b`.
901−Produces a list of all of the members that produce `%.n`. Inverse of
902−`++skim`.
903−
904−Accepts
905−-------
906−
907−`b` is a [gate]() that accepts one argument and produces a loobean.
908−
909−Produces
910−--------
911−
912−A list of the same type as `a`.
913−
914−Source
915−------
916−
917− ++ skip :: except
918− ~/ %skip
919− |* [a=(list) b=_|=(p=* .?(p))]
920− |-
921− ^+ a
922− ?~ a ~
923− ?:((b i.a) $(a t.a) [i.a $(a t.a)])
924−
925−Examples
926−--------
927−
928− ~zod/try=> =a |=(a=@ (gth a 1))
929− ~zod/try=> (skip (limo [0 1 2 3 ~]) a)
930− [i=0 t=[i=1 t=~]]
931−
932------------------------------------------------------------------------
54------------------------------------------------------------------------
933
55
934−### `++scag`
935−
936−Prefix
937−
938−Accepts an atom `a` and [list]() `b`, producing the first `a` elements of
939−the front of the list.
940−
941−Accepts
942−-------
943−
944−`b` is a list.
945−
946−Produces
947−--------
948−
949−A list of the same type as `b`.
950−
951−Source
952−------
953−
954− ++ scag :: prefix
955− ~/ %scag
956− |* [a=@ b=(list)]
957− |- ^+ b
958− ?: |(?=(~ b) =(0 a)) ~
959− [i.b $(b t.b, a (dec a))]
960−
961−Examples
962−--------
963−
964− ~zod/try=> (scag 2 (limo [0 1 2 3 ~]))
965− [i=0 t=[i=1 t=~]]
966− ~zod/try=> (scag 10 (limo [1 2 3 4 ~]))
967− [i=1 t=[i=2 t=[i=3 t=[i=4 t=~]]]]
968−
969------------------------------------------------------------------------
56------------------------------------------------------------------------
970
57
971−### `++slag`
972−
973−Suffix
974−
975−Accepts an atom `a` and list `b`, producing the remaining elements from
976−`b` starting at `a`.
977−
978−Accepts
979−-------
980−
981−`b` is a [list]().
982−
983−Produces
984−--------
985−
986−A list of the same type as `b`.
987−
988−Source
989−------
990−
991− ++ slag :: suffix
992− ~/ %slag
993− |* [a=@ b=(list)]
994− |- ^+ b
995− ?: =(0 a) b
996− ?~ b ~
997− $(b t.b, a (dec a))
998−
999−Examples
1000−--------
1001−
1002− ~zod/try=> (slag 2 (limo [1 2 3 4 ~]))
1003− [i=3 t=[i=4 t=~]]
1004− ~zod/try=> (slag 1 (limo [1 2 3 4 ~]))
1005− [i=2 t=[i=3 t=[i=4 t=~]]]
1006−
1007------------------------------------------------------------------------
58------------------------------------------------------------------------
1008
59
1009−### `++snag`
1010−
1011−Index
1012−
1013−Accepts an atom `a` and a [`++list`]() `b`, producing the element at the index
1014−of `a`and failing if the list is null. Lists are 0-indexed.
1015−
1016−Accepts
1017−-------
1018−
1019−`b` is a [list]().
1020−
1021−Produces
1022−--------
1023−
1024−Produces an element of `b`, or crashes if no element exists at that index.
1025−
1026−Source
1027−------
1028−
1029− ++ snag :: index
1030− ~/ %snag
1031− |* [a=@ b=(list)]
1032− |-
1033− ?~ b
1034− ~|('snag-fail' !!)
1035− ?: =(0 a) i.b
1036− $(b t.b, a (dec a))
1037−
1038−Examples
1039−--------
1040−
1041− ~zod/try=> (snag 2 "asdf")
1042− ~~d
1043− ~zod/try=> (snag 0 `(list ,@ud)`~[1 2 3 4])
1044− 1
1045−
1046------------------------------------------------------------------------
60------------------------------------------------------------------------
1047
61
1048−### `++sort`
1049−
1050−Quicksort
1051−
1052−Quicksort: accepts a [`++list`]() `a` and a [gate]() `b` which accepts two nouns and
1053−produces a loobean. `++sort` then produces a list of the elements of `a`,
1054−sorted according to `b`.
1055−
1056−Accepts
1057−-------
1058−
1059−`b` is a gate that ccepts two nouns and produces a boolean.
1060−
1061−Produces
1062−--------
1063−
1064−A list
1065−
1066−Source
1067−------
1068−
1069− ++ sort :: quicksort
1070− ~/ %sort
1071− |* [a=(list) b=$+([* *] ?)]
1072− => .(a ^.(homo a))
1073− |- ^+ a
1074− ?~ a ~
1075− %+ weld
1076− $(a (skim t.a |=(c=_i.a (b c i.a))))
1077− ^+ t.a
1078− [i.a $(a (skim t.a |=(c=_i.a !(b c i.a))))]
1079−
1080−Examples
1081−--------
1082−
1083− ~zod/try=> =a =|([p=@ q=@] |.((gth p q)))
1084− ~zod/try=> (sort (limo [0 1 2 3 ~]) a)
1085− ~[3 2 1 0]
1086−
1087------------------------------------------------------------------------
62------------------------------------------------------------------------
1088
63
1089−### `++swag`
1090−
1091−Infix
1092−
1093−Similar to `substr` in Javascript: extracts a string infix, beginning at
1094−inclusive index `a`, producing `b` number of characters.
1095−
1096−Accepts
1097−-------
1098−
1099−`c` is a [list]().
1100−
1101−Produces
1102−--------
1103−
1104−A list of the same type as `c`.
1105−
1106−Source
1107−------
1108−
1109− ++ swag :: infix
1110− |* [[a=@ b=@] c=(list)]
1111− (scag b (slag a c))
1112−
1113−Examples
1114−--------
1115−
1116− ~zod/try=> (swag [2 5] "roly poly")
1117− "ly po"
1118− ~zod/try=> (swag [2 2] (limo [1 2 3 4 ~]))
1119− [i=3 t=[i=4 t=~]]
1120−
1121------------------------------------------------------------------------
64------------------------------------------------------------------------
1122
65
1123−### `++turn`
1124−
1125−Gate to list
1126−
1127−Accepts a [`++list`]() `a` and a [gate]() `b`. Produces a list with the gate applied
1128−to each element of the original list.
1129−
1130−Accepts
1131−-------
1132−
1133−`b` is a gate.
1134−
1135−Produces
1136−--------
1137−
1138−A list.
1139−
1140−Source
1141−------
1142−
1143− ++ turn :: transform
1144− ~/ %turn
1145− |* [a=(list) b=_,*]
1146− |-
1147− ?~ a ~
1148− [i=(b i.a) t=$(a t.a)]
1149−
1150−Examples
1151−--------
1152−
1153− ~zod/try=> (turn (limo [104 111 111 110 ~]) ,@t)
1154− <|h o o n|>
1155− ~zod/try=> =a |=(a=@ (add a 4))
1156− ~zod/try=> (turn (limo [1 2 3 4 ~]) a)
1157− ~[5 6 7 8]
1158−
1159------------------------------------------------------------------------
66------------------------------------------------------------------------
1160
67
1161−### `++weld`
1162−
1163−Concatenate
1164−
1165−Concatenate two [`++list`]()s `a` and `b`.
1166−
1167−Accepts
1168−-------
1169−
1170−`a` and `b` are [list]()s.
1171−
1172−Source
1173−------
1174−
1175− ++ weld :: concatenate
1176− ~/ %weld
1177− |* [a=(list) b=(list)]
1178− => .(a ^.(homo a), b ^.(homo b))
1179− |- ^+ b
1180− ?~ a b
1181− [i.a $(a t.a)]
1182−
1183−Examples
1184−--------
1185−
1186− ~zod/try=> (weld "urb" "it")
1187− ~[~~u ~~r ~~b ~~i ~~t]
1188− ~zod/try=> (weld (limo [1 2 ~]) (limo [3 4 ~]))
1189− ~[1 2 3 4]
1190−
1191------------------------------------------------------------------------
68------------------------------------------------------------------------
1192
69
1193−### `++welp`
1194−
1195−Perfect weld
1196−
1197−Concatenate two [`++list`]()s `a` and `b` without losing their type information
1198−to homogenization.
1199−
1200−Accepts
1201−-------
1202−
1203−`a` is a list.
1204−
1205−`b` is a list.
1206−
1207−Produces
1208−--------
1209−
1210−A list.
1211−
1212−Source
1213−------
1214−
1215− ++ welp :: perfect weld
1216− =| [* *]
1217− |%
1218− +- $
1219− ?~ +<-
1220− +<-(. +<+)
1221− +<-(+ $(+<- +<->))
1222− --
1223−
1224−Examples
1225−--------
1226−
1227− ~zod/try=> (welp "foo" "bar")
1228− "foobar"
1229− ~zod/arvo=/hoon/hoon> (welp ~[60 61 62] ~[%a %b %c])
1230− [60 61 62 %a %b %c ~]
1231− ~zod/arvo=/hoon/hoon> :type; (welp ~[60 61 62] ~[%a %b %c])
1232− [60 61 62 %a %b %c ~]
1233− [@ud @ud @ud %a %b %c %~]
1234− ~zod/arvo=/hoon/hoon> (welp [sa/1 so/2 ~] si/3)
1235− [[%sa 1] [%so 2] %si 3]
1236−
1237------------------------------------------------------------------------
70------------------------------------------------------------------------
1238
71
1239−### `++wild`
1240−
1241−XXDELETE
1242−
1243− ++ wild :: concatenate
1244− |* [a=(list) b=(list)]
1245− => .(a ^.(homo a), b ^.(homo b))
1246− |-
1247− ?~ a b
1248− [i=i.a $(a t.a)]
1249−
1250−Concatenates two lists `a` and `b`, homogenizing their types
1251−individually.
1252−
1253−`a` and `b` are [list]()s.
1254−
1255− ~zod/try=> (wild (limo ~[1 2 3]) (limo [4]~))
1256− ~[1 2 3 4]
1257− ~zod/try=> (wild (limo 60 61 62 ~) (limo %a %b %c ~))
1258− [i=60 [i=61 [i=62 ~[%a %b %c]]]]
1259− ~zod/try=> (weld (limo 60 61 62 ~) (limo %a %b %c ~))
1260− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[10.000 15].[10.016 57]>
1261− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[10.001 15].[10.016 57]>
1262− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[10.002 15].[10.016 57]>
1263− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[10.004 15].[10.016 57]>
1264− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[10.006 15].[10.016 57]>
1265− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[10.006 29].[10.006 44]>
1266− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[10.056 3].[10.061 13]>
1267− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[10.058 3].[10.061 13]>
1268− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[10.059 3].[10.061 13]>
1269− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[10.060 5].[10.060 47]>
1270− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[9.826 7].[9.844 35]>
1271− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[9.827 7].[9.844 35]>
1272− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[9.827 11].[9.838 13]>
1273− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[9.828 11].[9.838 13]>
1274− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[9.829 13].[9.831 47]>
1275− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[9.830 13].[9.831 47]>
1276− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[9.706 7].[9.712 25]>
1277− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[9.707 7].[9.712 25]>
1278− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[9.708 7].[9.712 25]>
1279− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[9.712 7].[9.712 25]>
1280− ! /~zod/arvo/~2014.10.2..22.58.23..5af9/hoon/:<[9.712 8].[9.712 25]>
1281− ! exit
1282−
1283------------------------------------------------------------------------
72------------------------------------------------------------------------
1284
73
1285−### `++zing`
1286−
1287−Cons
1288−
1289−Turns a [`++list`]() of lists into a single list by promoting the elements of
1290−each sublist into the higher.
1291−
1292−Accepts
1293−-------
1294−
1295−A list of lists.
1296−
1297−Produces
1298−--------
1299−
1300−A list.
1301−
1302−Source
1303−------
1304−
1305− ++ zing :: promote
1306− =| *
1307− |%
1308− +- $
1309− ?~ +<
1310− +<
1311− (welp +<- $(+< +<+))
1312− --
1313−
1314−Examples
1315−--------
1316−
1317− ~zod/try=> (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~]))
1318− ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j']
1319− ~zod/try=> (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~]))
1320− ~[1 97 2 98 3 99 4 100]
docs/system/hoon/library/2c.md+28−3097
@@ -4,3173 +4,104 @@
4section 2cA, bit surgery
4section 2cA, bit surgery
5------------------------
5------------------------
6
6
7−### `++bex`
8−
9−Binary exponent
10−
11−Computes the result of `2^a`, producing an [atom]().
12−
13−Accepts
14−-------
15−
16−`a` is an atom.
17−
18−Produces
19−--------
20−
21−An atom.
22−
23−Source
24−------
25−
26− ++ bex :: binary exponent
27− ~/ %bex
28− |= a=@
29− ^- @
30− ?: =(0 a) 1
31− (mul 2 $(a (dec a)))
32−
33−Examples
34−--------
35−
36− ~zod/try=> (bex 4)
37− 16
38− ~zod/try=> (bex (add 19 1))
39− 1.048.576
40− ~zod/try=> (bex 0)
41− 1
42−
43−------------------------------------------------------------------------
44−
45−### `++xeb`
46−
47−Binary logarithm
48−
49−Computes the base-2 logarithm of `a`, producing an [atom]().
50−
51−Accepts
52−-------
53−
54−`a` is an atom.
55−
56−Produces
57−--------
58−
59−An atom.
60−
61−Source
62−------
63−
64− ++ xeb :: binary logarithm
65− :: ~/ %xeb
66− |= a=@
67− ^- @
68− (met 0 a)
69−
70−Examples
71−--------
72−
73− ~zod/try=> (xeb 31)
74− 5
75− ~zod/try=> (xeb 32)
76− 6
77− ~zod/try=> (xeb 49)
78− 6
79− ~zod/try=> (xeb 0)
80− 0
81− ~zod/try=> (xeb 1)
82− 1
83− ~zod/try=> (xeb 2)
84− 2
85−
86−------------------------------------------------------------------------
87−
88−### `++can`
89−
90−Assemble
91−
92−Produces an [atom]() from a list `b` of length-value pairs `p` and `q`,
93−where `p` is the length in bloqs of size `a`, and `q` is an atomic
94−value.
95−
96−Accepts
97−-------
98−
99−`a` is a block size (see [`++bloq`]()).
100−
101−`b` is a [`++list`]() of length value pairs, `p` and `q`.
102−
103−Produces
104−--------
105−
106−An atom.
107−
108−Source
109−------
110−
111− ++ can :: assemble
112− ~/ %can
113− |= [a=bloq b=(list ,[p=@ q=@])]
114− ^- @
115− ?~ b 0
116− (mix (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b)))
117−
118−Examples
119−--------
120−
121− ~zod/try=> `@ub`(can 3 ~[[1 1]])
122− 0b1
123− ~zod/try=> `@ub`(can 0 ~[[1 255]])
124− 0b1
125− ~zod/try=> `@ux`(can 3 [3 0xc1] [1 0xa] ~)
126− 0xa00.00c1
127− ~zod/try=> `@ux`(can 3 [3 0xc1] [1 0xa] [1 0x23] ~)
128− 0x23.0a00.00c1
129− ~zod/try=> `@ux`(can 4 [3 0xc1] [1 0xa] [1 0x23] ~)
130− 0x23.000a.0000.0000.00c1
131− ~zod/try=> `@ux`(can 3 ~[[1 'a'] [2 'bc']])
132− 0x63.6261
133−
134−------------------------------------------------------------------------
135−
136−### `++cat`
137−
138−Concatenate
139−
140−Concatenates two [atom]()s, `b` and `c`, according to bloq size `a`, producing an
141−atom.
142−
143−Accepts
144−-------
145−
146−`a` is a block size (see [`++bloq`]()).
147−
148−`b` is an atom.
149−
150−`c` is an atom.
151−
152−Produces
153−--------
154−
155−An atom.
156−
157−Source
158−------
159−
160− ++ cat :: concatenate
161− ~/ %cat
162− |= [a=bloq b=@ c=@]
163− (add (lsh a (met a b) c) b)
164−
165−Examples
166−--------
167−
168− ~zod/try=> `@ub`(cat 3 1 0)
169− 0b1
170− ~zod/try=> `@ub`(cat 0 1 1)
171− 0b11
172− ~zod/try=> `@ub`(cat 0 2 1)
173− 0b110
174− ~zod/try=> `@ub`(cat 2 1 1)
175− 0b1.0001
176− ~zod/try=> `@ub`256
177− 0b1.0000.0000
178− ~zod/try=> `@ub`255
179− 0b1111.1111
180− ~zod/try=> `@ub`(cat 3 256 255)
181− 0b1111.1111.0000.0001.0000.0000
182− ~zod/try=> `@ub`(cat 2 256 255)
183− 0b1111.1111.0001.0000.0000
184− ~zod/try=> (cat 3 256 255)
185− 16.711.936
186−
187−------------------------------------------------------------------------
188−
189−### `++cut`
190−
191−Slice
192−
193−Slices `c` blocks of size `a` that are `b` blocks from the end of `d`.
194−
195−Accepts
196−-------
197−
198−`a` is a block size (see [++bloq]()).
199−
200−`b` is an [atom]().
201−
202−`c` is an atom.
203−
204−Produces
205−--------
206−
207−An atom.
208−
209−Source
210−------
211−
212− ++ cut :: slice
213− ~/ %cut
214− |= [a=bloq [b=@ c=@] d=@]
215− (end a c (rsh a b d))
216−
217−Examples
218−--------
219−
220− ~zod/try=> (cut 0 [1 1] 2)
221− 1
222− ~zod/try=> (cut 0 [2 1] 4)
223− 1
224− ~zod/try=> `@t`(cut 3 [0 3] 'abcdefgh')
225− 'abc'
226− ~zod/try=> `@t`(cut 3 [1 3] 'abcdefgh')
227− 'bcd'
228− ~zod/try=> `@ub`(cut 0 [0 3] 0b1111.0000.1101)
229− 0b101
230− ~zod/try=> `@ub`(cut 0 [0 6] 0b1111.0000.1101)
231− 0b1101
232− ~zod/try=> `@ub`(cut 0 [4 6] 0b1111.0000.1101)
233− 0b11.0000
234− ~zod/try=> `@ub`(cut 0 [3 6] 0b1111.0000.1101)
235− 0b10.0001
236−
237−------------------------------------------------------------------------
238−
239−### `++end`
240−
241−Tail
242−
243−Produces an [atom]() by taking the last `b` blocks of size `a` from `c`.
244−
245−Accepts
246−-------
247−
248−`a` is a block size (see [`++bloq`]()).
249−
250−`b` is an atom.
251−
252−`c` is an [atom]().
253−
254−Produces
255−--------
256−
257−An atom.
258−
259−
260−Source
261−------
262−
263− ++ end :: tail
264− ~/ %end
265− |= [a=bloq b=@ c=@]
266− (mod c (bex (mul (bex a) b)))
267−
268−Examples
269−--------
270−
271− ~zod/try=> `@ub`12
272− 0b1100
273− ~zod/try=> `@ub`(end 0 3 12)
274− 0b100
275− ~zod/try=> (end 0 3 12)
276− 4
277− ~zod/try=> `@ub`(end 1 3 12)
278− 0b1100
279− ~zod/try=> (end 1 3 12)
280− 12
281− ~zod/try=> `@ux`'abc'
282− 0x63.6261
283− ~zod/try=> `@ux`(end 3 2 'abc')
284− 0x6261
285− ~zod/try=> `@t`(end 3 2 'abc')
286− 'ab'
287−
288−------------------------------------------------------------------------
289−
290−### `++fil`
291−
292−Fill bloqstream
293−
294−Produces an [atom]() by repeating `c` for `b` blocks of size `a`.
295−
296−Accepts
297−-------
298−
299−`a` is a block size (see [`++bloq`]()).
300−
301−`b` is an atom.
302−
303−`c` is an [atom]().
304−
305−Produces
306−--------
307−
308−An atom.
309−
310−Source
311−------
312−
313− ++ fil :: fill bloqstream
314− |= [a=bloq b=@ c=@]
315− =+ n=0
316− =+ d=c
317− |- ^- @
318− ?: =(n b)
319− (rsh a 1 d)
320− $(d (add c (lsh a 1 d)), n +(n))
321−
322−Examples
323−--------
324−
325− ~zod/try=> `@t`(fil 3 5 %a)
326− 'aaaaa'
327− ~zod/try=> `@t`(fil 5 10 %ceeb)
328− 'ceebceebceebceebceebceebceebceebceebceeb'
329− ~zod/try=> `@t`(fil 4 10 %eced)
330− 'ʇʇʇʇʇʇʇʇʇʇed'
331− ~zod/try=> `@tas`(fil 4 10 %bf)
332− %bfbfbfbfbfbfbfbfbfbf
333−
334−------------------------------------------------------------------------
335−
336−### `++lsh`
337−
338−Left-shift
339−
340−Produces an [atom]() by left-shifting `c` by `b` blocks of size `a`.
341−
342−Accepts
343−-------
344−
345−`a` is a block size (see [`++bloq`]()).
346−
347−`b` is an atom.
348−
349−`c` is an atom.
350−
351−Produces
352−--------
353−
354−An atom.
355−
356−Source
357−------
358−
359− ++ lsh :: left-shift
360− ~/ %lsh
361− |= [a=bloq b=@ c=@]
362− (mul (bex (mul (bex a) b)) c)
363−
364−Examples
365−--------
366−
367− ~zod/try=> `@ub`1
368− 0b1
369− ~zod/try=> `@ub`(lsh 0 1 1)
370− 0b10
371− ~zod/try=> (lsh 0 1 1)
372− 2
373− ~zod/try=> `@ub`255
374− 0b1111.1111
375− ~zod/try=> `@ub`(lsh 3 1 255)
376− 0b1111.1111.0000.0000
377− ~zod/try=> (lsh 3 1 255)
378− 65.280
379−
380−------------------------------------------------------------------------
381−
382−### `++me
383−
384−Measure
385−
386−Computes the number of blocks of size `a` in `b`, producing an [atom]().
387−
388−`a` is a block size (see [`++bloq`]()).
389−
390−`b` is an atom.
391−
392−Source
393−------
394−
395− ++ met :: measure
396− ~/ %met
397− |= [a=bloq b=@]
398− ^- @
399− =+ c=0
400− |-
401− ?: =(0 b) c
402− $(b (rsh a 1 b), c +(c))
403−
404−Examples
405−--------
406−
407− ~zod/try=> (met 0 1)
408− 1
409− ~zod/try=> (met 0 2)
410− 2
411− ~zod/try=> (met 3 255)
412− 1
413− ~zod/try=> (met 3 256)
414− 2
415− ~zod/try=> (met 3 'abcde')
416− 5
417−
418−------------------------------------------------------------------------
419−
420−### `++rap`
421−
422−Assemble non-zero
423−
424−Concatenates a list of [atom]()s `b` using blocksize `a`, producing an atom.
425−
426−Accepts
427−-------
428−
429−`a` is a block size (see [`++bloq`]()).
430−
431−`b` is a [`++list`]() of [atom]()s.
432−
433−Produces
434−--------
435−
436−An atom.
437−
438−Source
439−------
440−
441− ++ rap :: assemble nonzero
442− ~/ %rap
443− |= [a=bloq b=(list ,@)]
444− ^- @
445− ?~ b 0
446− (cat a i.b $(b t.b))
447−
448−Examples
449−--------
450−
451− ~zod/try=> `@ub`(rap 2 (limo [1 2 3 4 ~]))
452− 0b100.0011.0010.0001
453− ~zod/try=> `@ub`(rap 1 (limo [1 2 3 4 ~]))
454− 0b1.0011.1001
455− ~zod/try=> (rap 0 (limo [0 0 0 ~]))
456− 0
457− ~zod/try=> (rap 0 (limo [1 0 1 ~]))
458− 3
459−
460−------------------------------------------------------------------------
461−
462−### `++rep`
463−
464−Assemble single
465−
466−Produces an [atom]() by assembling a list of atoms `b` using block size `a`.
467−
468−Accepts
469−-------
470−
471−`a` is a block size (see [`++bloq`]()).
472−
473−`b` is a list of atoms.
474−
475−Produces
476−--------
477−
478−An atom.
479−
480−Source
481−------
482−
483− ++ rep :: assemble single
484− ~/ %rep
485− |= [a=bloq b=(list ,@)]
486− ^- @
487− =+ c=0
488− |-
489− ?~ b 0
490− (con (lsh a c (end a 1 i.b)) $(c +(c), b t.b))
491−
492−Examples
493−--------
494−
495− ~zod/try=> `@ub`(rep 2 (limo [1 2 3 4 ~]))
496− 0b100.0011.0010.0001
497− ~zod/try=> (rep 0 (limo [0 0 1 ~]))
498− 4
499− ~zod/try=> (rep 0 (limo [0 0 0 1 ~]))
500− 8
501− ~zod/try=> (rep 0 (limo [0 1 0 0 ~]))
502− 2
503− ~zod/try=> (rep 0 (limo [0 1 0 1 ~]))
504− 10
505− ~zod/try=> (rep 0 (limo [0 1 0 1 0 1 ~]))
506− 42
507− ~zod/try=> `@ub`42
508− 0b10.1010
509−
510−------------------------------------------------------------------------
511−
512−### `++rip`
513−
514−Disassemble
515−
516−Produces a list of [atom]()s from the bits of `b` using block size `a`.
517−
518−Accepts
519−-------
520−
521−`a` is a block size (see [`++bloq`]()).
522−
523−`b` is an atom.
524−
525−Produces
526−--------
527−
528−A list of atoms.
529−
530−Source
531−------
532−
533− ++ rip :: disassemble
534− ~/ %rip
535− |= [a=bloq b=@]
536− ^- (list ,@)
537− ?: =(0 b) ~
538− [(end a 1 b) $(b (rsh a 1 b))]
539−
540−Examples
541−--------
542−
543− ~zod/try=> `@ub`155
544− 0b1001.1011
545− ~zod/try=> (rip 0 155)
546− ~[1 1 0 1 1 0 0 1]
547− ~zod/try=> (rip 2 155)
548− ~[11 9]
549− ~zod/try=> (rip 1 155)
550− ~[3 2 1 2]
551− ~zod/try=> `@ub`256
552− 0b1.0000.0000
553− ~zod/try=> (rip 0 256)
554− ~[0 0 0 0 0 0 0 0 1]
555− ~zod/try=> (rip 2 256)
556− ~[0 0 1]
557− ~zod/try=> (rip 3 256)
558− ~[0 1]
559−
560−------------------------------------------------------------------------
561−
562−### `++rsh`
563−
564−Right-shift
565−
566−Right-shifts `c` by `b` blocks of size `a`, producing an [atom]().
567−
568−Accepts
569−-------
570−
571−`a` is a block size (see [`++bloq`]()).
572−
573−`b` is an atom.
574−
575−`c` is an atom.
576−
577−Produces
578−--------
579−
580−An atom.
581−
582−Source
583−------
584−
585− ++ rsh :: right-shift
586− ~/ %rsh
587− |= [a=bloq b=@ c=@]
588− (div c (bex (mul (bex a) b)))
589−
590−Examples
591−--------
592−
593− ~zod/try=> `@ub`145
594− 0b1001.0001
595− ~zod/try=> `@ub`(rsh 1 1 145)
596− 0b10.0100
597− ~zod/try=> (rsh 1 1 145)
598− 36
599− ~zod/try=> `@ub`(rsh 2 1 145)
600− 0b1001
601− ~zod/try=> (rsh 2 1 145)
602− 9
603− ~zod/try=> `@ub`10
604− 0b1010
605− ~zod/try=> `@ub`(rsh 0 1 10)
606− 0b101
607− ~zod/try=> (rsh 0 1 10)
608− 5
609− ~zod/try=> `@ux`'abc'
610− 0x63.6261
611− ~zod/try=> `@t`(rsh 3 1 'abc')
612− 'bc'
613− ~zod/try=> `@ux`(rsh 3 1 'abc')
614− 0x6362
615−
616−------------------------------------------------------------------------
617−
618−### `++swap`
619−
620−Reverse block order
621−
622−Switches little endian to big and vice versa: produces an [atom]() by
623−reversing the block order of `b` using block size `a`.
624−
625−
626−Accepts
627−-------
628−
629−`a` is a block size (see [`++bloq`]()).
630−
631−`b` is an atom.
632−
633−Produces
634−--------
635−
636−An atom
637−
638−Source
639−------
640−
641− ++ swap |=([a=bloq b=@] (rep a (flop (rip a b)))) :: reverse bloq order
642−
643−Examples
644−--------
645−
646− ~zod/try=> `@ub`24
647− 0b1.1000
648− ~zod/try=> (swap 0 24)
649− 3
650− ~zod/try=> `@ub`3
651− 0b11
652− ~zod/try=> (swap 0 0)
653− 0
654− ~zod/try=> (swap 0 128)
655− 1
656−
657−------------------------------------------------------------------------
658−
659−section 2cB, bit logic
660−----------------------
661−
662−### `++con`
663−
664−Binary OR
665−
666−Computes the bit-wise logical OR of two [atom]()s, `a` and `b`, producing an
667−atom.
668−
669−Accepts
670−-------
671−
672−`a` is an atom
673−
674−`b` is an atom
675−
676−Produces
677−--------
678−
679−An atom.
680−
681−Source
682−------
683−
684− ++ con :: binary or
685− ~/ %con
686− |= [a=@ b=@]
687− =+ [c=0 d=0]
688− |- ^- @
689− ?: ?&(=(0 a) =(0 b)) d
690− %= $
691− a (rsh 0 1 a)
692− b (rsh 0 1 b)
693− c +(c)
694− d %+ add d
695− %^ lsh 0 c
696− ?& =(0 (end 0 1 a))
697− =(0 (end 0 1 b))
698− ==
699− ==
700−
701−Examples
702−--------
703−
704− ~zod/try=> (con 0b0 0b1)
705− 1
706− ~zod/try=> (con 0 1)
707− 1
708− ~zod/try=> (con 0 0)
709− 0
710− ~zod/try=> `@ub`(con 0b1111.0000 0b1.0011)
711− 0b1111.0011
712− ~zod/try=> (con 4 4)
713− 4
714− ~zod/try=> (con 10.000 234)
715− 10.234
716−
717−------------------------------------------------------------------------
718−
719−### `++dis`
720−
721−Binary AND
722−
723−Computes the bit-wise logical AND of two [atom]()s `a` and `b`, producing an
724−atom.
725−
726−Accepts
727−-------
728−
729−`a` is an atom.
730−
731−`b` is an atom.
732−
733−Produces
734−--------
735−
736−An atom.
737−
738−Source
739−------
740−
741− ++ dis :: binary and
742− ~/ %dis
743− |= [a=@ b=@]
744− =| [c=@ d=@]
745− |- ^- @
746− ?: ?|(=(0 a) =(0 b)) d
747− %= $
748− a (rsh 0 1 a)
749− b (rsh 0 1 b)
750− c +(c)
751− d %+ add d
752− %^ lsh 0 c
753− ?| =(0 (end 0 1 a))
754− =(0 (end 0 1 b))
755− ==
756− ==
757−
758−Examples
759−--------
760−
761− ~zod/try=> `@ub`9
762− 0b1001
763− ~zod/try=> `@ub`5
764− 0b101
765− ~zod/try=> `@ub`(dis 9 5)
766− 0b1
767− ~zod/try=> (dis 9 5)
768− 1
769− ~zod/try=> `@ub`534
770− 0b10.0001.0110
771− ~zod/try=> `@ub`987
772− 0b11.1101.1011
773− ~zod/try=> `@ub`(dis 534 987)
774− 0b10.0001.0010
775− ~zod/try=> (dis 534 987)
776− 530
777−
778−------------------------------------------------------------------------
779−
780−### `++mix`
781−
782−Binary XOR
783−
784−Produces the bit-wise logical XOR of `a` and `b`, producing an [atom]().
785−
786−Accepts
787−-------
788−
789−`a` is an atom
790−
791−`b` is an atom
792−
793−Produces
794−--------
795−
796−An atom.
797−
798−Source
799−------
800−
801− ++ mix :: binary xor
802− ~/ %mix
803− |= [a=@ b=@]
804− ^- @
805− =+ [c=0 d=0]
806− |-
807− ?: ?&(=(0 a) =(0 b)) d
808− %= $
809− a (rsh 0 1 a)
810− b (rsh 0 1 b)
811− c +(c)
812− d (add d (lsh 0 c =((end 0 1 a) (end 0 1 b))))
813− ==
814−
815−Examples
816−--------
817−
818− ~zod/try=> `@ub`2
819− 0b10
820− ~zod/try=> `@ub`3
821− 0b11
822− ~zod/try=> `@ub`(mix 2 3)
823− 0b1
824− ~zod/try=> (mix 2 3)
825− 1
826− ~zod/try=> `@ub`(mix 2 2)
827− 0b0
828− ~zod/try=> (mix 2 2)
829− 0
830−
831−------------------------------------------------------------------------
832−
833−### `++not`
834−
835−Binary NOT
836−
837−Computes the bit-wise logical NOT of the bottom `b` blocks of size `a`
838−of `c`.
839−
840−Accepts
841−-------
842−
843−`a` is a block size (see [`++bloq`]()).
844−
845−`b` is an [atom]().
846−
847−`c` is an atom.
848−
849−Produces
850−--------
851−
852−An atom.
853−
854−Source
855−------
856−
857− ++ not |= [a=bloq b=@ c=@] :: binary not (sized)
858− (mix c (dec (bex (mul b (bex a)))))
859−
860−Examples
861−--------
862−
863− ~zod/try=> `@ub`24
864− 0b1.1000
865− ~zod/try=> (not 0 5 24)
866− 7
867− ~zod/try=> `@ub`7
868− 0b111
869− ~zod/try=> (not 2 5 24)
870− 1.048.551
871− ~zod/try=> (not 2 5 1.048.551)
872− 24
873− ~zod/try=> (not 1 1 (not 1 1 10))
874− 10
875−
876−------------------------------------------------------------------------
877−
878−section 2cC, noun orders
879−------------------------
880−
881−### `++aor`
882−
883−Alphabetic order
884−
885−Computes whether `a` and `b` are in alphabetical order, producing a
886−boolean.
887−
888−Accepts
889−-------
890−
891−`a` is a [noun]().
892−
893−`b` is a noun.
894−
895−Produces
896−--------
897−
898−A boolean atom.
899−
900−
901−Source
902−------
903−
904− ++ aor :: alphabetic-order
905− ~/ %aor
906− |= [a=* b=*]
907− ^- ?
908− ?: =(a b) &
909− ?. ?=(@ a)
910− ?: ?=(@ b) |
911− ?: =(-.a -.b)
912− $(a +.a, b +.b)
913− $(a -.a, b -.b)
914− ?. ?=(@ b) &
915− |-
916− =+ [c=(end 3 1 a) d=(end 3 1 b)]
917− ?: =(c d)
918− $(a (rsh 3 1 a), b (rsh 3 1 b))
919− (lth c d)
920−
921−Examples
922−--------
923−
924− ~zod/try=> (aor 'a' 'b')
925− %.y
926− ~zod/try=> (aor 'b' 'a')
927− %.n
928− ~zod/try=> (aor "foo" "bar")
929− %.n
930− ~zod/try=> (aor "bar" "foo")
931− %.y
932− ~zod/try=> (aor "abcdefz" "abcdefa")
933− %.n
934− ~zod/try=> (aor "abcdefa" "abcdefz")
935− %.y
936− ~zod/try=> (aor 10.000 17.000)
937− %.y
938− ~zod/try=> (aor 10 9)
939− %.n
940−
941−------------------------------------------------------------------------
942−
943−### `++dor`
944−
945−Numeric order
946−
947−Computes whether `a` and `b` are in ascending numeric order, producing a
948−boolean.
949−
950−Accepts
951−-------
952−
953−`a` is a [noun]().
954−
955−`b` is a noun.
956−
957−Produces
958−--------
959−
960−A boolean atom.
961−
962−Source
963−------
964−
965− ++ dor :: d-order
966− ~/ %dor
967− |= [a=* b=*]
968− ^- ?
969− ?: =(a b) &
970− ?. ?=(@ a)
971− ?: ?=(@ b) |
972− ?: =(-.a -.b)
973− $(a +.a, b +.b)
974− $(a -.a, b -.b)
975− ?. ?=(@ b) &
976− (lth a b)
977−
978−Examples
979−--------
980−
981− ~zod/try=> (dor 1 2)
982− %.y
983− ~zod/try=> (dor 2 1)
984− %.n
985− ~zod/try=> (dor ~[1 2 3] ~[1 2 4])
986− %.y
987− ~zod/try=> (dor ~[1 2 4] ~[1 2 3])
988− %.n
989− ~zod/try=> (dor (limo ~[99 100 10.000]) ~[99 101 10.000])
990− %.y
991− ~zod/try=> (dor ~[99 101 10.999] (limo ~[99 100 10.000]))
992− %.n
993−
994−------------------------------------------------------------------------
995−
996−### `++gor`
997−
998−Hash order
999−
1000−XX revisit
1001−
1002−Accepts
1003−-------
1004−
1005−`a` is a [noun]().
1006−
1007−`b` is a noun.
1008−
1009−Produces
1010−--------
1011−
1012−A boolean [atom]().
1013−
1014−Source
1015−------
1016−
1017− ++ gor :: g-order
1018− ~/ %gor
1019− |= [a=* b=*]
1020− ^- ?
1021− =+ [c=(mug a) d=(mug b)]
1022− ?: =(c d)
1023− (dor a b)
1024− (lth c d)
1025−
1026−Examples
1027−--------
1028−
1029− ~zod/try=> (gor 'd' 'c')
1030− %.y
1031− ~zod/try=> 'd'
1032− 'd'
1033− ~zod/try=> 'c'
1034− ~zod/try=> `@ud`'d'
1035− 100
1036− ~zod/try=> `@ud`'c'
1037− 99
1038− ~zod/try=> (mug 'd')
1039− 1.628.185.714
1040− ~zod/try=> (mug 'c')
1041− 1.712.073.811
1042− ~zod/try=> (gor 'd' 'c')
1043− %.y
1044− ~zod/try=> (gor 'c' 'd')
1045− %.n
1046− ~zod/try=> (gor "foo" "bar")
1047− %.n
1048− ~zod/try=> (gor (some 10) (limo [1 2 3 ~]))
1049− %.n
1050−
1051−------------------------------------------------------------------------
1052−
1053−### `++hor`
1054−
1055−Hash order
1056−
1057−XX revisit
1058−
1059−Recursive hash comparator gate.
1060−
1061−Accepts
1062−-------
1063−
1064−`a` is a [noun]().
1065−
1066−`b` is a noun.
1067−
1068−Produces
1069−--------
1070−
1071−A boolean [atom]().
1072−
1073−
1074−Source
1075−------
1076−
1077− ++ hor :: h-order
1078− ~/ %hor
1079− |= [a=* b=*]
1080− ^- ?
1081− ?: ?=(@ a)
1082− ?. ?=(@ b) &
1083− (gor a b)
1084− ?: ?=(@ b) |
1085− ?: =(-.a -.b)
1086− (gor +.a +.b)
1087− (gor -.a -.b)
1088−
1089−Examples
1090−--------
1091−
1092− ~zod/try=> (hor . 1)
1093− %.n
1094− ~zod/try=> (hor 1 2)
1095− %.y
1096− ~zod/try=> (hor "abc" "cba")
1097− %.y
1098− ~zod/try=> (hor 'c' 'd')
1099− %.n
1100−
1101−------------------------------------------------------------------------
1102−
1103−### `++vor`
1104−
1105−Double hash comparator gate.
1106−
1107−XX revisit
1108−
1109−Accepts
1110−-------
1111−
1112−`a` is a [noun]()
1113−
1114−`b` is a noun
1115−
1116−Produces
1117−-------
1118−
1119−Source
1120−------
1121−
1122− ++ vor :: v-order
1123− ~/ %vor
1124− |= [a=* b=*]
1125− ^- ?
1126− =+ [c=(mug (mug a)) d=(mug (mug b))]
1127− ?: =(c d)
1128− (dor a b)
1129− (lth c d)
1130−
1131−Examples
1132−--------
1133−
1134− ~zod/try=> (vor 'f' 'g')
1135− %.y
1136− ~zod/try=> (vor 'a' 'z')
1137− %.n
1138− ~zod/try=> (vor 43.326 41.106)
1139− %.n
1140−
1141−section 2cD, insecure hashing
1142−-----------------------------
1143−
1144−### `++fnv`
1145−
1146−Hashes an atom with the 32-bit FNV non-cryptographic hash algorithm.
1147−Multiplies `a` by the prime number 16,777,619 and then takes the block
1148−of size 5 off the product's end, producing an [atom]().
1149−
1150−Accepts
1151−-------
1152−
1153−`a` is an atom.
1154−
1155−Produces
1156−--------
1157−
1158−An atom.
1159−
1160−
1161−Source
1162−------
1163−
1164− ++ fnv |=(a=@ (end 5 1 (mul 16.777.619 a))) :: FNV scrambler
1165−
1166−Examples
1167−--------
1168−
1169− ~zod/try=> (fnv 10.000)
1170− 272.465.456
1171− ~zod/try=> (fnv 10.001)
1172− 289.243.075
1173− ~zod/try=> (fnv 1)
1174− 16.777.619
1175−
1176−------------------------------------------------------------------------
1177−
1178−### `++mum`
1179−
1180−XX document
1181−
1182−Accepts
1183−-------
1184−
1185−Produces
1186−--------
1187−
1188−Source
1189−------
1190−
1191− ++ mum :: mug with murmur3
1192− ~/ %mum
1193− |= a=*
1194− |^ (trim ?@(a a (mix $(a -.a) (mix 0x7fff.ffff $(a +.a)))))
1195− ++ spec :: standard murmur3
1196− |= [syd=@ key=@]
1197− ?> (lte (met 5 syd) 1)
1198− =+ ^= row
1199− |= [a=@ b=@]
1200− (con (end 5 1 (lsh 0 a b)) (rsh 0 (sub 32 a) b))
1201− =+ mow=|=([a=@ b=@] (end 5 1 (mul a b)))
1202− =+ len=(met 5 key)
1203− =- =. goc (mix goc len)
1204− =. goc (mix goc (rsh 4 1 goc))
1205− =. goc (mow goc 0x85eb.ca6b)
1206− =. goc (mix goc (rsh 0 13 goc))
1207− =. goc (mow goc 0xc2b2.ae35)
1208− (mix goc (rsh 4 1 goc))
1209− ^= goc
1210− =+ [inx=0 goc=syd]
1211− |- ^- @
1212− ?: =(inx len) goc
1213− =+ kop=(cut 5 [inx 1] key)
1214− =. kop (mow kop 0xcc9e.2d51)
1215− =. kop (row 15 kop)
1216− =. kop (mow kop 0x1b87.3593)
1217− =. goc (mix kop goc)
1218− =. goc (row 13 goc)
1219− =. goc (end 5 1 (add 0xe654.6b64 (mul 5 goc)))
1220− $(inx +(inx))
1221− ::
1222− ++ trim :: 31-bit nonzero
1223− |= key=@
1224− =+ syd=0xcafe.babe
1225− |- ^- @
1226− =+ haz=(spec syd key)
1227− =+ ham=(mix (rsh 0 31 haz) (end 0 31 haz))
1228− ?.(=(0 ham) ham $(syd +(syd)))
1229− --
1230− ::
1231−
1232−Examples
1233−--------
1234−
1235− ~zod/try=> (mum 10.000)
1236− 1.232.632.901
1237− ~zod/try=> (mum 10.001)
1238− 658.093.079
1239− ~zod/try=> (mum 1)
1240− 818.387.364
1241− ~zod/try=> (mum (some 10))
1242− 1.177.215.703
1243− ~zod/try=> (mum ~[1 2 3 4 5])
1244− 1.517.902.092
1245−
1246−### `++mug`
1247−
1248−Hashes `a` with the 31-bit nonzero FNV-1a non-cryptographic hash
1249−algorithm, producing an [atom]().
1250−
1251−Accepts
1252−-------
1253−
1254−A is a [noun]().
1255−
1256−Produces
1257−--------
1258−
1259−An atom.
1260−
1261−Source
1262−------
1263−
1264− ++ mug :: 31bit nonzero FNV1a
1265− ~/ %mug
1266− |= a=*
1267− ?^ a
1268− =+ b=[p=$(a -.a) q=$(a +.a)]
1269− |- ^- @
1270− =+ c=(fnv (mix p.b (fnv q.b)))
1271− =+ d=(mix (rsh 0 31 c) (end 0 31 c))
1272− ?. =(0 c) c
1273− $(q.b +(q.b))
1274− =+ b=2.166.136.261
1275− |- ^- @
1276− =+ c=b
1277− =+ [d=0 e=(met 3 a)]
1278− |- ^- @
1279− ?: =(d e)
1280− =+ f=(mix (rsh 0 31 c) (end 0 31 c))
1281− ?. =(0 f) f
1282− ^$(b +(b))
1283− $(c (fnv (mix c (cut 3 [d 1] a))), d +(d))
1284−
1285−Examples
1286−--------
1287−
1288− ~zod/try=> (mug 10.000)
1289− 178.152.889
1290− ~zod/try=> (mug 10.001)
1291− 714.838.017
1292− ~zod/try=> (mug 1)
1293− 67.918.732
1294− ~zod/try=> (mug (some 10))
1295− 1.872.403.737
1296− ~zod/try=> (mug (limo [1 2 3 4 5 ~]))
1297− 1.067.931.605
1298−
1299−section 2cE, phonetic base
1300−--------------------------
1301−
1302−### `++po`
1303−
1304−++ po
1305− ~/ %po
1306− =+ :- ^= sis :: prefix syllables
1307− 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\
1308− /rigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\
1309− /holpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\
1310− /losdilforpilramtirwintadbicdifrocwidbisdasmidlop\
1311− /rilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\
1312− /ritpodmottamtolsavposnapnopsomfinfonbanporworsip\
1313− /ronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\
1314− /sivtagpadsaldivdactansidfabtarmonranniswolmispal\
1315− /lasdismaprabtobrollatlonnodnavfignomnibpagsopral\
1316− /bilhaddocridmocpacravripfaltodtiltinhapmicfanpat\
1317− /taclabmogsimsonpinlomrictapfirhasbosbatpochactid\
1318− /havsaplindibhosdabbitbarracparloddosbortochilmac\
1319− /tomdigfilfasmithobharmighinradmashalraglagfadtop\
1320− /mophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\
1321− /nimlarfitwalrapsarnalmoslandondanladdovrivbacpol\
1322− /laptalpitnambonrostonfodponsovnocsorlavmatmipfap'
1323− ^= dex :: suffix syllables
1324− 'zodnecbudwessevpersutletfulpensytdurwepserwylsun\
1325− /rypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\
1326− /lunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\
1327− /pyldulhetmevruttylwydtepbesdexsefwycburderneppur\
1328− /rysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\
1329− /secmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\
1330− /selrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\
1331− /syptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\
1332− /lytdusnebrumtynseglyxpunresredfunrevrefmectedrus\
1333− /bexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\
1334− /tenlusnussyltecmexpubrymtucfyllepdebbermughuttun\
1335− /bylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\
1336− /wedducfurfexnulluclennerlexrupnedlecrydlydfenwel\
1337− /nydhusrelrudneshesfetdesretdunlernyrsebhulryllud\
1338− /remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\
1339− /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes'
1340− |%
1341−
1342−Provides the phonetic syllables and name generators for the Urbit naming
1343−system. The two faces, `sis` and `dex` are available to the arms
1344−contained in this section.
1345−
1346−------------------------------------------------------------------------
1347−
1348−### `++ind`
1349−
1350−Parse prefix
1351−
1352−Produces the byte of the right-hand syllable `a`.
1353−
1354−Accepts
1355−-------
1356−
1357−`a` is an [atom]().
1358−
1359−Produces
1360−--------
1361−
1362−A [`++unit`]() of an atom.
1363−
1364−Source
1365−------
1366−
1367− ++ ind ~/ %ind :: parse prefix
1368− |= a=@
1369− =+ b=0
1370− |- ^- (unit ,@)
1371− ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b))))
1372−
1373−Examples
1374−--------
1375−
1376− ~zod/try=> (ind:po 'zod')
1377− [~ 0]
1378− ~zod/try=> (ind:po 'zam')
1379− ~
1380− ~zod/try=> (ind:po 'del')
1381− [~ 37]
1382−
1383−------------------------------------------------------------------------
1384−
1385−### `++ins`
1386−
1387−Parse suffix
1388−
1389−Produces the byte of the left-hand phonetic syllable `b`.
1390−
1391−Accepts
1392−-------
1393−
1394−`a` is an [atom]().
1395−
1396−Produces
1397−--------
1398−A [`++unit`]() of an atom.
1399−
1400−Source
1401−------
1402−
1403− ++ ins ~/ %ins :: parse suffix
1404− |= a=@
1405− =+ b=0
1406− |- ^- (unit ,@)
1407− ?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b))))
1408−
1409−Examples
1410−--------
1411−
1412− ~zod/try=> (ins:po 'mar')
1413− [~ 1]
1414− ~zod/try=> (ins:po 'son')
1415− [~ 164]
1416− ~zod/try=> (ins:po 'pit')
1417− [~ 242]
1418− ~zod/try=> (ins:po 'pok')
1419− ~
1420−
1421−------------------------------------------------------------------------
1422−
1423−### `++tod`
1424−
1425−Fetch prefix
1426−
1427−Produces the phonetic prefix syllable from index `a` within `dex` as an
1428−[atom]().
1429−
1430−Accepts
1431−-------
1432−
1433−`a` is an atom
1434−
1435−Produces
1436−--------
1437−
1438−An atom.
1439−
1440−
1441−Source
1442−------
1443−
1444− ++ tod ~/ %tod :: fetch prefix
1445− |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))
1446−
1447−Examples
1448−--------
1449−
1450− ~zod/try=> `@t`(tod:po 1)
1451− 'nec'
1452− ~zod/try=> `@t`(tod:po 98)
1453− 'dec'
1454− ~zod/try=> `@t`(tod:po 0)
1455− 'zod'
1456− ~zod/try=> `@t`(tod:po 150)
1457− 'ryg'
1458− ~zod/try=> `@t`(tod:po 255)
1459− 'fes'
1460− ~zod/try=> `@t`(tod:po 256)
1461− ! exit
1462−
1463−------------------------------------------------------------------------
1464−
1465−### `++tos`
1466−
1467−Fetch suffix
1468−
1469−Produces the phonetic prefix syllable from index `a` within `sis` as an
1470−[atom]().
1471−
1472−Accepts
1473−-------
1474−
1475−`a` is an atom.
1476−
1477−Produces
1478−--------
1479−
1480−An atom.
1481−
1482−Source
1483−------
1484−
1485− ++ tos ~/ %tos :: fetch suffix
1486− |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))
1487−
1488−Examples
1489−--------
1490−
1491− ~zod/try=> `@t`(tos:po 0)
1492− 'doz'
1493− ~zod/try=> `@t`(tos:po 120)
1494− 'fab'
1495− ~zod/try=> `@t`(tos:po 43)
1496− 'pid'
1497− ~zod/try=> `@t`(tos:po 253)
1498− 'mat'
1499−
1500−------------------------------------------------------------------------
1501−
1502−section 2cF, signed and modular ints
1503−------------------------------------
1504−
1505−### `++si`
1506−
1507− ++ si !: :: signed integer
1508− |%
1509−
1510−Container core for the signed integer functions.
1511−
1512−------------------------------------------------------------------------
1513−
1514−### `++abs`
1515−
1516−Absolute value
1517−
1518−Produces the absolute value of a signed integer.
1519−
1520−Accepts
1521−-------
1522−
1523−`a` is a signed integer, [`@s`]().
1524−
1525−Produces
1526−--------
1527−
1528−An [atom]().
1529−
1530−Source
1531−------
1532−
1533− ++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a))) :: absolute value
1534−
1535−Examples
1536−--------
1537−
1538− ~zod/try=> (abs:si -2)
1539− 2
1540− ~zod/try=> (abs:si -10.000)
1541− 10.000
1542− ~zod/try=> (abs:si --2)
1543− 2
1544−
1545−------------------------------------------------------------------------
1546−
1547−### `++dif`
1548−
1549−Difference
1550−
1551−Produces the difference between two signed integers `b` and `c`.
1552−
1553−Accepts
1554−-------
1555−
1556−`a` is a signed integer, [`@s`]().
1557−
1558−`b` is a signed integer, `@s`.
1559−
1560−Produces
1561−--------
1562−
1563−A [`@s`]().
1564−
1565−
1566−Source
1567−------
1568−
1569− ++ dif |= [a=@s b=@s] :: subtraction
1570− (sum a (new !(syn b) (abs b)))
1571−
1572−Examples
1573−--------
1574−
1575− ~zod/try=> (dif:si --10 -7)
1576− --17
1577− ~zod/try=> (dif:si --10 --7)
1578− --3
1579− ~zod/try=> (dif:si `@s`0 --7)
1580− -7
1581− ~zod/try=> (dif:si `@s`0 `@s`7)
1582− --4
1583−
1584−------------------------------------------------------------------------
1585−
1586−### `++dul`
1587−
1588−Modulus
1589−
1590−Produces the modulus of two signed integers.
1591−
1592−Accepts
1593−-------
1594−
1595−`a` is a signed integer, `@s`.
1596−
1597−`b` is an [atom]().
1598−
1599−Produces
1600−--------
1601−
1602−An atom.
1603−
1604−Source
1605−------
1606−
1607− ++ dul |= [a=@s b=@] :: modulus
1608− =+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c)))
1609−
1610−Examples
1611−--------
1612−
1613− ~zod/try=> (dul:si --9 3)
1614− 0
1615− ~zod/try=> (dul:si --9 4)
1616− 1
1617− ~zod/try=> (dul:si --9 5)
1618− 4
1619− ~zod/try=> (dul:si --9 6)
1620− 3
1621− ~zod/try=> (dul:si --90 --10)
1622− 10
1623−
1624−------------------------------------------------------------------------
1625−
1626−### `++fra`
1627−
1628−Divide
1629−
1630−Produces the quotient of two signed integers.
1631−
1632−Accepts
1633−-------
1634−
1635−`a` is a signed integer, [`@s`].
1636−
1637−`b` is a signed integer, `@s`.
1638−
1639−Produces
1640−--------
1641−
1642−An [atom]().
1643−
1644−Source
1645−------
1646−
1647− ++ fra |= [a=@s b=@s] :: divide
1648− (new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b)))
1649−
1650−Examples
1651−--------
1652−
1653− ~zod/try=> (fra:si --10 -2)
1654− -5
1655− ~zod/try=> (fra:si -20 -5)
1656− --4
1657−
1658−------------------------------------------------------------------------
1659−
1660−### `++new`
1661−
1662−Signed integer
1663−
1664−Produces a signed integer from a loobean sign value `a` and an [atom]() `b`.
1665−
1666−Accepts
1667−-------
1668−
1669−`a` is a loobean.
1670−
1671−`b` is an atom.
1672−
1673−Produces
1674−--------
1675−
1676−A [`@s`]()
1677−
1678−Source
1679−------
1680−
1681− ++ new |= [a=? b=@] :: [sign value] to @s
1682− `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b)))))
1683−
1684−Examples
1685−--------
1686−
1687− ~zod/try=> (new:si [& 10])
1688− --10
1689− ~zod/try=> (new:si [| 10])
1690− -10
1691− ~zod/try=> (new:si [%.y 7])
1692− --7
1693−
1694−------------------------------------------------------------------------
1695−
1696−### `++old`
1697−
1698−[sign value]
1699−
1700−Produces the cell `[sign value]` representations of a signed integer.
1701−
1702−Accepts
1703−-------
1704−
1705−`a` is a [`@s`]().
1706−
1707−Produces
1708−--------
1709−
1710−A cell of a boolean and an [atom]().
1711−
1712−Source
1713−------
1714−
1715− ++ old |=(a=@s [(syn a) (abs a)]) :: [sign value]
1716−
1717−Examples
1718−--------
1719−
1720− ~zod/try=> (old:si 7)
1721− ! type-fail
1722− ! exit
1723− ~zod/try=> (old:si -7)
1724− [%.n 7]
1725− ~zod/try=> (old:si --7)
1726− [%.y 7]
1727− ~zod/try=> (old:si `@s`7)
1728− [%.n 4]
1729− ~zod/try=> (old:si -0)
1730− [%.y 0]
1731−
1732−------------------------------------------------------------------------
1733−
1734−### `++pro`
1735−
1736−Multiply
1737−
1738−Produces the product of two signed integers.
1739−
1740−Accepts
1741−-------
1742−
1743−`a` is a [`@s`]().
1744−
1745−`b` is a `@s`.
1746−
1747−Produces
1748−--------
1749−
1750−A `@s`.
1751−
1752−Source
1753−------
1754−
1755− ++ pro |= [a=@s b=@s] :: multiplication
1756− (new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b)))
1757−
1758−Examples
1759−--------
1760−
1761− ~zod/try=> (pro:si -4 --2)
1762− -8
1763− ~zod/try=> (pro:si -4 -2)
1764− --8
1765− ~zod/try=> (pro:si --10.000.000 -10)
1766− -100.000.000
1767− ~zod/try=> (pro:si -1.337 --0)
1768− --0
1769−
1770−------------------------------------------------------------------------
1771−
1772−### `++rem`
1773−
1774−Remainder
1775−
1776−Produces the remainder from a division of two signed integers.
1777−
1778−Accepts
1779−-------
1780−
1781−`a` is a [`@s`]().
1782−
1783−`b` is a `@s`.
1784−
1785−Produces
1786−--------
1787−
1788−A `@sd`.
1789−
1790−Source
1791−------
1792−
1793− ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b)))) :: remainder
1794−
1795−Examples
1796−--------
1797−
1798− ~zod/try=> (rem:si -10 -4)
1799− -2
1800− ~zod/try=> (rem:si --10 --4)
1801− --2
1802− ~zod/try=> (rem:si --10 -4)
1803− --2
1804− ~zod/try=> (rem:si --7 --3)
1805− --1
1806− ~zod/try=> (rem:si --0 --10.000)
1807− --0
1808−
1809−------------------------------------------------------------------------
1810−
1811−### `++sum`
1812−
1813−Add
1814−
1815−Sum two signed integers.
1816−
1817−Accepts
1818−-------
1819−
1820−`b` is a [`@s`]().
1821−
1822−`c` is a signed integer `@s`.
1823−
1824−Produces
1825−--------
1826−
1827−A `@s`.
1828−
1829−Source
1830−------
1831−
1832− ++ sum |= [a=@s b=@s] :: addition
1833− ~| %si-sum
1834− =+ [c=(old a) d=(old b)]
1835− ?: -.c
1836− ?: -.d
1837− (new & (add +.c +.d))
1838− ?: (gte +.c +.d)
1839− (new & (sub +.c +.d))
1840− (new | (sub +.d +.c))
1841− ?: -.d
1842− ?: (gte +.c +.d)
1843− (new | (sub +.c +.d))
1844− (new & (sub +.d +.c))
1845− (new | (add +.c +.d))
1846−
1847−Examples
1848−--------
1849−
1850− ~zod/try=> (sum:si --10 --10)
1851− --20
1852− ~zod/try=> (sum:si --10 -0)
1853− --10
1854− ~zod/try=> (sum:si -10 -7)
1855− -17
1856− ~zod/try=> (sum:si -10 --7)
1857− -3
1858−
1859−------------------------------------------------------------------------
1860−
1861−### `++sun`
1862−
1863−Signed from unsigned
1864−
1865−Produces a signed integer from an unsigned integer.
1866−
1867−Note that the result must be manually cast to some [`@s`]() odor to be
1868−inferred as an unsigned integer in the type system.
1869−
1870−Accepts
1871−-------
1872−
1873−`a` is a [`@u`]().
1874−
1875−Produces
1876−--------
1877−
1878−A [`@s`]().
1879−
1880−Source
1881−------
1882−
1883− ++ sun |=(a=@u (mul 2 a)) :: @u to @s
1884−
1885−Examples
1886−--------
1887−
1888− ~zod/try=> `@s`10
1889− --5
1890− ~zod/try=> (sun:si 10)
1891− 20
1892− ~zod/try=> `@s`(sun:si 10)
1893− --10
1894− ~zod/try=> `@sd`(sun:si 10)
1895− --10
1896− ~zod/try=> `@sd`(sun:si 12.345)
1897− --12.345
1898−
1899−------------------------------------------------------------------------
1900−
1901−### `++syn`
1902−
1903−Sign
1904−
1905−Produce the sign of a signed integer, where `&` is posiitve, and `|` is negative.
1906−
1907−Accepts
1908−-------
1909−
1910−`a` is a [`@s`]().
1911−
1912−Produces
1913−--------
1914−
1915−A boolean.
1916−
1917−Source
1918−------
1919−
1920− ++ syn |=(a=@s =(0 (end 0 1 a))) :: sign test
1921−
1922−Examples
1923−--------
1924−
1925− ~zod/try=> (syn:si -2)
1926− %.n
1927− ~zod/try=> (syn:si --2)
1928− %.y
1929− ~zod/try=> (syn:si -0)
1930− %.y
1931−
1932−------------------------------------------------------------------------
1933−
1934−### `++cmp`
1935−
1936−Compare
1937−
1938−Compare two signed integers.
1939−
1940−Accepts
1941−-------
1942−
1943−`b` is a [`@s`]().
1944−
1945−`c` is a `@s`.
1946−
1947−Produces
1948−--------
1949−
1950−A `@s`.
1951−
1952−Source
1953−------
1954−
1955− ++ cmp |= [a=@s b=@s] :: compare
1956− ^- @s
1957− ?: =(a b)
1958− --0
1959− ?: (syn a)
1960− ?: (syn b)
1961− ?: (gth a b)
1962− --1
1963− -1
1964− --1
1965− ?: (syn b)
1966− -1
1967− ?: (gth a b)
1968− -1
1969− --1
1970−
1971−Examples
1972−--------
1973−
1974− ~zod/try=> (cmp:si --10 --10)
1975− --0
1976− ~zod/try=> (cmp:si --10 -0)
1977− --1
1978− ~zod/try=> (cmp:si -10 -7)
1979− -1
1980− ~zod/try=> (cmp:si -10 --7)
1981− -1
1982−
1983−
1984−### `++fe` :: modulo bloq
1985−
1986−Modulo bloq
1987−
1988−Core containing XX
1989−
1990−Accepts
1991−-------
1992−
1993−`a` is a [`++bloq`]().
1994−
1995−Source
1996−------
1997−
1998− |_ a=bloq
1999−
2000−### `++dif`
2001−
2002−Produces the difference between two [atom]()s in the modular basis
2003−representation.
2004−
2005−Accepts
2006−-------
2007−
2008−`a` is a [`++bloq`]().
2009−
2010−`b` is an atom.
2011−
2012−`c` is an atom.
2013−
2014−Produces
2015−--------
2016−
2017−A [`@s`]()
2018−
2019−Source
2020−------
2021−
2022− ++ dif |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c))))
2023−
2024−Examples
2025−--------
2026−
2027− ~zod/try=> (~(dif fe 3) 63 64)
2028− 255
2029− ~zod/try=> (~(dif fe 3) 5 10)
2030− 251
2031− ~zod/try=> (~(dif fe 3) 0 1)
2032− 255
2033− ~zod/try=> (~(dif fe 0) 9 10)
2034− 1
2035− ~zod/try=> (~(dif fe 0) 9 11)
2036− 0
2037− ~zod/try=> (~(dif fe 0) 9 12)
2038− 1
2039− ~zod/try=> (~(dif fe 2) 9 12)
2040− 13
2041− ~zod/try=> (~(dif fe 2) 63 64)
2042− 15
2043−
2044−------------------------------------------------------------------------
2045−
2046−### `++inv`
2047−
2048−Invert mod field
2049−
2050−Inverts the order of the modular field.
2051−
2052−Accepts
2053−-------
2054−
2055−`b` is a [`++bloq`]().
2056−
2057−Produces
2058−--------
2059−
2060−An atom.
2061−
2062−
2063−Source
2064−------
2065−
2066− ++ inv |=(b=@ (sub (dec out) (sit b)))
2067−
2068−Examples
2069−--------
2070−
2071− ~zod/try=> (~(inv fe 3) 255)
2072− 0
2073− ~zod/try=> (~(inv fe 3) 256)
2074− 255
2075− ~zod/try=> (~(inv fe 3) 0)
2076− 255
2077− ~zod/try=> (~(inv fe 3) 1)
2078− 254
2079− ~zod/try=> (~(inv fe 3) 2)
2080− 253
2081− ~zod/try=> (~(inv fe 3) 55)
2082− 200
2083−
2084−------------------------------------------------------------------------
2085−
2086−### `++net`
2087−
2088−Reverse bytes
2089−
2090−Revereses bytes within block.
2091−
2092−Accepts
2093−-------
2094−
2095−`b` is a [`++bloq`]().
2096−
2097−Produces
2098−--------
2099−
2100−An atom.=
2101−
2102−Source
2103−------
2104−
2105− ++ net |= b=@ ^- @
2106− => .(b (sit b))
2107− ?: (lte a 3)
2108− b
2109− =+ c=(dec a)
2110− %+ con
2111− (lsh c 1 $(a c, b (cut c [0 1] b)))
2112− $(a c, b (cut c [1 1] b))
2113−
2114−Examples
2115−--------
2116−
2117− ~zod/try=> (~(net fe 3) 64)
2118− 64
2119− ~zod/try=> (~(net fe 3) 128)
2120− 128
2121− ~zod/try=> (~(net fe 3) 255)
2122− 255
2123− ~zod/try=> (~(net fe 3) 256)
2124− 0
2125− ~zod/try=> (~(net fe 3) 257)
2126− 1
2127− ~zod/try=> (~(net fe 3) 500)
2128− 244
2129− ~zod/try=> (~(net fe 3) 511)
2130− 255
2131− ~zod/try=> (~(net fe 3) 512)
2132− 0
2133− ~zod/try=> (~(net fe 3) 513)
2134− 1
2135− ~zod/try=> (~(net fe 3) 0)
2136− 0
2137− ~zod/try=> (~(net fe 3) 1)
2138− 1
2139− ~zod/try=> (~(net fe 0) 1)
2140− 1
2141− ~zod/try=> (~(net fe 0) 2)
2142− 0
2143− ~zod/try=> (~(net fe 0) 3)
2144− 1
2145− ~zod/try=> (~(net fe 6) 1)
2146− 72.057.594.037.927.936
2147− ~zod/try=> (~(net fe 6) 2)
2148− 144.115.188.075.855.872
2149− ~zod/try=> (~(net fe 6) 3)
2150− 216.172.782.113.783.808
2151− ~zod/try=> (~(net fe 6) 4)
2152− 288.230.376.151.711.744
2153− ~zod/try=> (~(net fe 6) 5)
2154− 360.287.970.189.639.680
2155− ~zod/try=> (~(net fe 6) 6)
2156− 432.345.564.227.567.616
2157− ~zod/try=> (~(net fe 6) 7)
2158− 504.403.158.265.495.552
2159− ~zod/try=> (~(net fe 6) 512)
2160− 562.949.953.421.312
2161− ~zod/try=> (~(net fe 6) 513)
2162− 72.620.543.991.349.248
2163−
2164−------------------------------------------------------------------------
2165−
2166−### `++out`
2167−
2168−Max integer value
2169−
2170−The maximum integer value that the current block can store.
2171−
2172−Accepts
2173−-------
2174−
2175−A [`++bloq`]().
2176−
2177−Produces
2178−--------
2179−
2180−An [atom]().
2181−
2182−Source
2183−------
2184−
2185− ++ out (bex (bex a))
2186−
2187−Examples
2188−--------
2189−
2190− ~zod/try=> ~(out fe 0)
2191− 2
2192− ~zod/try=> ~(out fe 1)
2193− 4
2194− ~zod/try=> ~(out fe 2)
2195− 16
2196− ~zod/try=> ~(out fe 3)
2197− 256
2198− ~zod/try=> ~(out fe 4)
2199− 65.536
2200− ~zod/try=> ~(out fe 10)
2201− \/179.769.313.486.231.590.772.930.519.078.902.473.361.797.697.894.230.657.\/
2202− 273.430.081.157.732.675.805.500.963.132.708.477.322.407.536.021.120.113.
2203− 879.871.393.357.658.789.768.814.416.622.492.847.430.639.474.124.377.767.
2204− 893.424.865.485.276.302.219.601.246.094.119.453.082.952.085.005.768.838.
2205− 150.682.342.462.881.473.913.110.540.827.237.163.350.510.684.586.298.239.
2206− 947.245.938.479.716.304.835.356.329.624.224.137.216
2207− \/ \/
2208−
2209−------------------------------------------------------------------------
2210−
2211−### `++rol`
2212−
2213−Roll left
2214−
2215−Roll `d` to the left by `c` `b`-sized blocks.
2216−
2217−Accepts
2218−-------
2219−
2220−`a` is a [`++bloq`]().
2221−
2222−`b` is a `++bloq`.
2223−
2224−`c` is an atom.
2225−
2226−`d` is an atom.
2227−
2228−Produces
2229−--------
2230−
2231−An atom.
2232−
2233−Source
2234−------
2235−
2236− ++ rol |= [b=bloq c=@ d=@] ^- @ :: roll left
2237− =+ e=(sit d)
2238− =+ f=(bex (sub a b))
2239− =+ g=(mod c f)
2240− (sit (con (lsh b g e) (rsh b (sub f g) e)))
2241−
2242−Examples
2243−--------
2244−
2245− ~zod/try=> `@ux`(~(rol fe 6) 4 3 0xabac.dedf.1213)
2246− 0x1213.0000.abac.dedf
2247− ~zod/try=> `@ux`(~(rol fe 6) 4 2 0xabac.dedf.1213)
2248− 0xdedf.1213.0000.abac
2249− ~zod/try=> `@t`(~(rol fe 5) 3 1 'dfgh')
2250− 'hdfg'
2251− ~zod/try=> `@t`(~(rol fe 5) 3 2 'dfgh')
2252− 'ghdf'
2253− ~zod/try=> `@t`(~(rol fe 5) 3 0 'dfgh')
2254− 'dfgh'
2255−
2256−------------------------------------------------------------------------
2257−
2258−### `++ror`
2259−
2260−Roll right
2261−
2262−Roll `d` to the right by `c` `b`-sized blocks.
2263−
2264−Accepts
2265−-------
2266−
2267−`a` is a [`++bloq`]().
2268−
2269−`b` is a `++bloq`.
2270−
2271−`c` is an [atom]().
2272−
2273−`d` is an atom.
2274−
2275−Produces
2276−--------
2277−
2278−An atom.
2279−
2280−Source
2281−------
2282−
2283− ++ ror |= [b=bloq c=@ d=@] ^- @ :: roll right
2284− =+ e=(sit d)
2285− =+ f=(bex (sub a b))
2286− =+ g=(mod c f)
2287− (sit (con (rsh b g e) (lsh b (sub f g) e)))
2288−
2289−Examples
2290−--------
2291−
2292− ~zod/try=> `@ux`(~(ror fe 6) 4 1 0xabac.dedf.1213)
2293− 0x1213.0000.abac.dedf
2294− ~zod/try=> `@ux`(~(ror fe 6) 3 5 0xabac.dedf.1213)
2295− 0xacde.df12.1300.00ab
2296− ~zod/try=> `@ux`(~(ror fe 6) 3 3 0xabac.dedf.1213)
2297− 0xdf12.1300.00ab.acde
2298− ~zod/try=> `@t`(~(rol fe 5) 3 0 'hijk')
2299− 'hijk'
2300− ~zod/try=> `@t`(~(rol fe 5) 3 1 'hijk')
2301− 'khij'
2302− ~zod/try=> `@t`(~(rol fe 5) 3 2 'hijk')
2303− 'jkhi'
2304−
2305------------------------------------------------------------------------
7------------------------------------------------------------------------
2306
8
2307−### `++sum`
2308−
2309−Sum
2310−
2311−Sum two numbers in this modular field.
2312−
2313−Accepts
2314−-------
2315−
2316−`a` is a [`++bloq`]().
2317−
2318−`b` is an [atom]().
2319−
2320−`c` is an atom.
2321−
2322−Produces
2323−--------
2324−
2325−An atom.
2326−
2327−Source
2328−------
2329−
2330− ++ sum |=([b=@ c=@] (sit (add b c))) :: wrapping add
2331−
2332−Examples
2333−--------
2334−
2335− ~zod/try=> (~(sum fe 3) 10 250)
2336− 4
2337− ~zod/try=> (~(sum fe 0) 0 1)
2338− 1
2339− ~zod/try=> (~(sum fe 0) 0 2)
2340− 0
2341− ~zod/try=> (~(sum fe 2) 14 2)
2342− 0
2343− ~zod/try=> (~(sum fe 2) 14 3)
2344− 1
2345− ~zod/try=> (~(sum fe 4) 10.000 256)
2346− 10.256
2347− ~zod/try=> (~(sum fe 4) 10.000 100.000)
2348− 44.464
2349−
2350−### `++sit`
2351−
2352−Atom in mod block representation
2353−
2354−Produce an [atom]() in the current modular block representation.
2355−
2356−Accepts
2357−-------
2358−
2359−`a` is a [`++bloq`]().
2360−
2361−`b` is an atom.
2362−
2363−Produces
2364−--------
2365−
2366−An atom.
2367−
2368−Source
2369−------
2370−
2371− ++ sit |=(b=@ (end a 1 b)) :: enforce modulo
2372−
2373−Examples
2374−--------
2375−
2376− ~zod/try=> (~(sit fe 3) 255)
2377− 255
2378− ~zod/try=> (~(sit fe 3) 256)
2379− 0
2380− ~zod/try=> (~(sit fe 3) 257)
2381− 1
2382− ~zod/try=> (~(sit fe 2) 257)
2383− 1
2384− ~zod/try=> (~(sit fe 2) 10.000)
2385− 0
2386− ~zod/try=> (~(sit fe 2) 100)
2387− 4
2388− ~zod/try=> (~(sit fe 2) 19)
2389− 3
2390− ~zod/try=> (~(sit fe 2) 17)
2391− 1
2392− ~zod/try=> (~(sit fe 0) 17)
2393− 1
2394− ~zod/try=> (~(sit fe 0) 0)
2395− 0
2396− ~zod/try=> (~(sit fe 0) 1)
2397− 1
2398−
2399------------------------------------------------------------------------
9------------------------------------------------------------------------
2400
10
2401−section 2cG, floating point
2402−---------------------------
2403−
2404−XX awaiting interface rewrite
2405−
2406−section 2cH, urbit time
2407−-----------------------
2408−
2409−Note that entering '-\<-' in the shell produces the current time in @da
2410−format. We use this for many of our examples.
2411−
2412− ~zod/try=> -<-
2413− ~2014.8.4..19.39.59..9288
2414−
2415−### `++year`
2416−
2417−Accept a parsed date of form `[[a=? y=@ud] m=@ud t=tarp]` and produce
2418−its `@d`representation.
2419−
2420−Accepts
2421−-------
2422−
2423−`det` is a [`++date`]()
2424−
2425−Produces
2426−--------
2427−
2428−A [`@d`]().
2429−
2430−Source
2431−------
2432−
2433− ++ year :: date to @d
2434− |= det=date
2435− ^- @d
2436− =+ ^= yer
2437− ?: a.det
2438− (add 292.277.024.400 y.det)
2439− (sub 292.277.024.400 (dec y.det))
2440− =+ day=(yawn yer m.det d.t.det)
2441− (yule day h.t.det m.t.det s.t.det f.t.det)
2442−
2443−Examples
2444−--------
2445−
2446− ~zod/try=> (year [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=4 s=57 f=~[0xd940]]])
2447− 0x8000000d227df4e9d940000000000000
2448−
2449------------------------------------------------------------------------
11------------------------------------------------------------------------
2450
12
2451−### `++yore`
2452−
2453−Produces a `++date` from a `@d`
2454−
2455−Accepts
2456−-------
2457−
2458−`now` is a `@d`.
2459−
2460−Produces
2461−--------
2462−
2463−A [`++date`]().
2464−
2465−Source
2466−------
2467−
2468− ++ yore :: @d to date
2469− |= now=@d
2470− ^- date
2471− =+ rip=(yell now)
2472− =+ ger=(yall d.rip)
2473− :- ?: (gth y.ger 292.277.024.400)
2474− [a=& y=(sub y.ger 292.277.024.400)]
2475− [a=| y=+((sub 292.277.024.400 y.ger))]
2476− [m.ger d.ger h.rip m.rip s.rip f.rip]
2477−
2478−Examples
2479−--------
2480−
2481− ~zod/try=> (yore -<-)
2482− [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=17 s=1 f=~[0x700d]]]
2483− ~zod/try=> (yore -<-)
2484− [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=28 s=53 f=~[0x7b82]]]
2485−
2486−### `++yell`
2487−
2488−Produce a parsed daily time format from an atomic date.
2489−
2490−`now` is a `@d`.
2491−
2492−Source
2493−------
2494−
2495− ++ yell :: tarp from @d
2496− |= now=@d
2497− ^- tarp
2498− =+ sec=(rsh 6 1 now)
2499− =+ ^= fan
2500− =+ [muc=4 raw=(end 6 1 now)]
2501− |- ^- (list ,@ux)
2502− ?: |(=(0 raw) =(0 muc))
2503− ~
2504− => .(muc (dec muc))
2505− [(cut 4 [muc 1] raw) $(raw (end 4 muc raw))]
2506− =+ day=(div sec day:yo)
2507− => .(sec (mod sec day:yo))
2508− =+ hor=(div sec hor:yo)
2509− => .(sec (mod sec hor:yo))
2510− =+ mit=(div sec mit:yo)
2511− => .(sec (mod sec mit:yo))
2512− [day hor mit sec fan]
2513−
2514−Examples
2515−--------
2516−
2517− ~zod/try=> (yell ~2014.3.20..05.42.53..7456)
2518− [d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]]
2519− ~zod/try=> (yell ~2014.6.9..19.09.40..8b66)
2520− [d=106.751.991.820.175 h=19 m=9 s=40 f=~[0x8b66]]
2521− ~zod/try=> (yell ~1776.7.4)
2522− [d=106.751.991.733.273 h=0 m=0 s=0 f=~]
2523−
2524------------------------------------------------------------------------
13------------------------------------------------------------------------
2525
14
2526−### `++yule`
2527−
2528−Daily time to time atom
2529−
2530−Accept a [`++tarp`](/doc/hoon/library/1#++tarp), a parsed daily time, and produces a time atom,
2531−`@d`.
2532−
2533−Accepts
2534−-------
2535−
2536−`rip` is a [`++tarp`](/doc/hoon/library/1#++tarp).
2537−
2538−Produces
2539−--------
2540−
2541−A [`@d`]().
2542−
2543−Source
2544−------
2545−
2546− ++ yule :: time atom
2547− |= rip=tarp
2548− ^- @d
2549− =+ ^= sec ;: add
2550− (mul d.rip day:yo)
2551− (mul h.rip hor:yo)
2552− (mul m.rip mit:yo)
2553− s.rip
2554− ==
2555− =+ ^= fac =+ muc=4
2556− |- ^- @
2557− ?~ f.rip
2558− 0
2559− => .(muc (dec muc))
2560− (add (lsh 4 muc i.f.rip) $(f.rip t.f.rip))
2561− (con (lsh 6 1 sec) fac)
2562−
2563−Examples
2564−--------
2565−
2566− ~zod/try=> =murica (yell ~1776.7.4)
2567− ~zod/try=> murica
2568− [d=106.751.991.733.273 h=0 m=0 s=0 f=~]
2569− ~zod/try=> (yule murica)
2570− 0x8000000b62aaf5800000000000000000
2571− ~zod/try=> `@da`(yule murica)
2572− ~1776.7.4
2573− ~zod/try=> `@da`(yule (yell ~2014.3.20..05.42.53..7456))
2574− ~2014.3.20..05.42.53..7456
2575− ~zod/try=> `tarp`[31 12 30 0 ~]
2576− [d=31 h=12 m=30 s=0 f=~]
2577− ~zod/try=> `@dr`(yule `tarp`[31 12 30 0 ~])
2578− ~d31.h12.m30
2579−
2580------------------------------------------------------------------------
15------------------------------------------------------------------------
2581
16
2582−### `++yall`
2583−
2584−Time since beginning of time
2585−
2586−Produce the date tuple of `[y=@ud m=@ud d=@ud]` of the year, month, and
2587−day from a number of days from the beginning of time.
2588−
2589−Accepts
2590−-------
2591−
2592−`day` is a [`@ud`]()
2593−
2594−Produces
2595−--------
2596−
2597−
2598−Source
2599−------
2600−
2601− ++ yall :: day # to day of year
2602− |= day=@ud
2603− ^- [y=@ud m=@ud d=@ud]
2604− =+ [era=0 cet=0 lep=_?]
2605− => .(era (div day era:yo), day (mod day era:yo))
2606− => ^+ .
2607− ?: (lth day +(cet:yo))
2608− .(lep &, cet 0)
2609− => .(lep |, cet 1, day (sub day +(cet:yo)))
2610− .(cet (add cet (div day cet:yo)), day (mod day cet:yo))
2611− =+ yer=(add (mul 400 era) (mul 100 cet))
2612− |- ^- [y=@ud m=@ud d=@ud]
2613− =+ dis=?:(lep 366 365)
2614− ?. (lth day dis)
2615− =+ ner=+(yer)
2616− $(yer ner, day (sub day dis), lep =(0 (end 0 2 ner)))
2617− |- ^- [y=@ud m=@ud d=@ud]
2618− =+ [mot=0 cah=?:(lep moy:yo moh:yo)]
2619− |- ^- [y=@ud m=@ud d=@ud]
2620− =+ zis=(snag mot cah)
2621− ?: (lth day zis)
2622− [yer +(mot) +(day)]
2623− $(mot +(mot), day (sub day zis))
2624−
2625−Examples
2626−--------
2627−
2628− ~zod/try=> (yall 198)
2629− [y=0 m=7 d=17]
2630− ~zod/try=> (yall 90.398)
2631− [y=247 m=7 d=3]
2632− ~zod/try=> (yall 0)
2633− [y=0 m=1 d=1]
2634−
2635------------------------------------------------------------------------
17------------------------------------------------------------------------
2636
18
2637−### `++yawn`
2638−
2639−Days since beginning of time
2640−
2641−Inverse of `yall`, computes number of days A.D. from y/m/d date as the
2642−tuple `[yer=@ud mot=@ud day=@ud]`.
2643−
2644−Accepts
2645−-------
2646−
2647−`yer` is an unsigned decimal, `@ud`.
2648−
2649−`mon` is an unsigned decimal, `@ud`.
2650−
2651−`day` is an unsigned decimal, `@ud`.
2652−
2653−Produces
2654−--------
2655−
2656−A [`@ud`]().
2657−
2658−Source
2659−------
2660−
2661− ++ yawn :: days since Jesus
2662− |= [yer=@ud mot=@ud day=@ud]
2663− ^- @ud
2664− => .(mot (dec mot), day (dec day))
2665− => ^+ .
2666− %= .
2667− day
2668− =+ cah=?:((yelp yer) moy:yo moh:yo)
2669− |- ^- @ud
2670− ?: =(0 mot)
2671− day
2672− $(mot (dec mot), cah (slag 1 cah), day (add day (snag 0 cah)))
2673− ==
2674− |- ^- @ud
2675− ?. =(0 (mod yer 4))
2676− =+ ney=(dec yer)
2677− $(yer ney, day (add day ?:((yelp ney) 366 365)))
2678− ?. =(0 (mod yer 100))
2679− =+ nef=(sub yer 4)
2680− $(yer nef, day (add day ?:((yelp nef) 1.461 1.460)))
2681− ?. =(0 (mod yer 400))
2682− =+ nec=(sub yer 100)
2683− $(yer nec, day (add day ?:((yelp nec) 36.525 36.524)))
2684− (add day (mul (div yer 400) (add 1 (mul 4 36.524))))
2685−
2686−Examples
2687−--------
2688−
2689− ~zod/try=> (yawn 2.014 8 4)
2690− 735.814
2691− ~zod/try=> (yawn 1.776 7 4)
2692− 648.856
2693− ~zod/try=> (yawn 1.990 10 11)
2694− 727.116
2695−
2696------------------------------------------------------------------------
19------------------------------------------------------------------------
2697
20
2698−### `++yelp`
2699−
2700−Leap-week?
2701−
2702−Determines whether a year contains an ISO 8601 leap week. Produces a
2703−loobean.
2704−
2705−Accepts
2706−-------
2707−
2708−`yer` is an unsigned decimal, `@ud`.
2709−
2710−Produces
2711−--------
2712−
2713−A boolean.
2714−
2715−Source
2716−------
2717−
2718− ++ yelp :: leap year
2719− |= yer=@ud ^- ?
2720− &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400))))
2721−
2722−Examples
2723−--------
2724−
2725− ~zod/try=> (yelp 2.014)
2726− %.n
2727− ~zod/try=> (yelp 2.008)
2728− %.y
2729− ~zod/try=> (yelp 0)
2730− %.y
2731− ~zod/try=> (yelp 14.011)
2732− %.n
2733−
2734------------------------------------------------------------------------
21------------------------------------------------------------------------
2735
22
2736−### `++yo`
2737−
2738− ++ yo :: time constants core
2739−
2740−Useful constants for interacting with earth time.
2741−
2742−### `++cet`
2743−
2744−Days in a century. Derived by multiplying the number of days in a year
2745−(365) by the number of years in a century (100), then adding the number
2746−days from leap years in a century (24).
2747−
2748−Produces
2749−--------
2750−
2751−An [atom]().
2752−
2753−Source
2754−------
2755−
2756− |% ++ cet 36.524 :: (add 24 (mul 100 365))
2757−
2758−Examples
2759−--------
2760−
2761− ~zod/try=> cet:yo
2762− 36.524
2763− ~zod/try=> (add 365 cet:yo)
2764− 36.889
2765− ~zod/try=> (sub (add 24 (mul 100 365)) cet:yo)
2766− 0
2767−
2768------------------------------------------------------------------------
23------------------------------------------------------------------------
2769
24
2770−### `++day`
2771−
2772−Number of seconds in a day.
2773−
2774−Produces
2775−--------
2776−
2777−An [atom]().
2778−
2779−Source
2780−------
2781−
2782− ++ day 86.400 :: (mul 24 hor)
2783−
2784−Examples
2785−--------
2786−
2787− ~zod/try=> day:yo
2788− 86.400
2789− ~zod/try=> (add 60 day:yo)
2790− 86.460
2791−
2792------------------------------------------------------------------------
25------------------------------------------------------------------------
2793
26
2794−### `++era`
2795−
2796−XX Revisit
2797−
2798−Produces
2799−--------
2800−
2801−An [atom]().
2802−
2803−Source
2804−------
2805−
2806− ++ era 146.097 :: (add 1 (mul 4 cet))
2807−
2808−Examples
2809−--------
2810−
2811−
2812------------------------------------------------------------------------
27------------------------------------------------------------------------
2813
28
2814−### `++hor`
2815−
2816−Seconds in hour
2817−
2818−The number of seconds in an hour. Derived by multiplying the number of
2819−seconds in a minute by the minutes in an hour.
2820−
2821−Produces
2822−--------
2823−
2824−An [atom]().
2825−
2826−Source
2827−------
2828−
2829− ++ hor 3.600 :: (mul 60 mit)
2830−
2831−Examples
2832−--------
2833−
2834− ~zod/try=> hor:yo
2835− 3.600
2836− ~zod/try=> (div hor:yo 60)
2837− 60
2838−
2839------------------------------------------------------------------------
29------------------------------------------------------------------------
2840
30
2841−### `++jes`
2842−
2843−XX Revisit
2844−
2845−Produces
2846−--------
2847−
2848−An atom.
2849−
2850−Source
2851−------
2852−
2853− ++ jes 106.751.991.084.417 :: (mul 730.692.561 era)
2854−
2855−Examples
2856−--------
2857−
2858− ~zod/try=> jes:yo
2859− 106.751.991.084.417
2860−
2861------------------------------------------------------------------------
31------------------------------------------------------------------------
2862
32
2863−### `++mit`
2864−
2865−Seconds in minute
2866−
2867−The number of seconds in a minute.
2868−
2869−Produces
2870−--------
2871−
2872−An [atom]().
2873−
2874−Source
2875−------
2876−
2877− ++ mit 60
2878−
2879−Examples
2880−--------
2881−
2882− ~zod/try=> mit:yo
2883− 60
2884−
2885------------------------------------------------------------------------
33------------------------------------------------------------------------
2886
34
2887−### `++moh`
35+section 2cB, bit logic
2888−
36+----------------------
2889−Days in month
2890−
2891−The days in each month of the Gregorian common year. A list of unsigned
2892−decimal atoms (Either 28, 30, or 31) denoting the number of days in the
2893−month at the year at that index.
2894−
2895−Produces
2896−--------
2897−
2898−A [`++list`]() of [`@ud`]()
2899−
2900−Source
2901−------
2902−
2903− ++ moh `(list ,@ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~]
2904−
2905−Examples
2906−--------
2907−
2908− ~zod/try=> moh:yo
2909− ~[31 28 31 30 31 30 31 31 30 31 30 31]
2910− ~zod/try=> (snag 4 moh:yo)
2911− 31
2912
37
2913------------------------------------------------------------------------
38------------------------------------------------------------------------
2914
39
2915−### `++moy`
40+------------------------------------------------------------------------
2916−
2917−Moh with leapyear
2918−
2919−The days in each month of the Gregorian leap-year. A list of unsigned
2920−decimal atoms (Either 29,30, or 31) denoting the number of days in the
2921−month at the leap-year at that index.
2922
41
2923−Examples
42+------------------------------------------------------------------------
2924−--------
2925
43
2926−A [`++list`]() of [`@ud`]()
44+------------------------------------------------------------------------
2927
45
2928−Source
46+section 2cC, noun orders
2929−------
47+------------------------
2930
48
2931− ++ moy `(list ,@ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~]
49+------------------------------------------------------------------------
2932
50
2933−Examples
51+------------------------------------------------------------------------
2934−--------
2935
52
2936− ~zod/try=> moy:yo
53+------------------------------------------------------------------------
2937− ~[31 29 31 30 31 30 31 31 30 31 30 31]
2938− ~zod/try=> (snag 1 moy:yo)
2939− 29
2940
54
2941------------------------------------------------------------------------
55------------------------------------------------------------------------
2942
56
2943−### `++qad`
57+section 2cD, insecure hashing
58+-----------------------------
2944
59
2945−Seconds in 4 years
60+------------------------------------------------------------------------
2946
61
2947−The number of seconds in four years. Derived by adding one second to the
62+section 2cE, phonetic base
2948−number of seconds in four years.
63+--------------------------
2949
64
2950−Produces
2951−--------
2952
65
2953−An [atom]().
66+section 2cF, signed and modular ints
67+------------------------------------
2954
68
2955−Source
2956−------
2957
69
2958− ++ qad 126.144.001 :: (add 1 (mul 4 yer))
70+section 2cH, urbit time
71+-----------------------
2959
72
2960−Examples
73+Note that entering '-\<-' in the shell produces the current time in @da
2961−--------
74+format. We use this for many of our examples.
2962
75
2963− ~zod/try=> qad:yo
76+ ~zod/try=> -<-
2964− 126.144.001
77+ ~2014.8.4..19.39.59..9288
2965
78
2966------------------------------------------------------------------------
79------------------------------------------------------------------------
2967
80
2968−### `++yer`
2969−
2970−Seconds in year
2971−
2972−The number of seconds in a year. Derived by multiplying the number of
2973−seconds in a day by 365.
2974−
2975−Produces
2976−--------
2977
81
2978−An [atom]().
82+------------------------------------------------------------------------
2979
83
2980−Source
84+------------------------------------------------------------------------
2981−------
2982
85
2983− ++ yer 31.536.000 :: (mul 365 day)
86+------------------------------------------------------------------------
2984
87
2985−Examples
88+------------------------------------------------------------------------
2986−--------
2987
89
2988− ~zod/try=> yer:yo
90+------------------------------------------------------------------------
2989− 31.536.000
2990
91
2991------------------------------------------------------------------------
92------------------------------------------------------------------------
2992
93
2993section 2cI, almost macros
94section 2cI, almost macros
2994--------------------------
95--------------------------
2995
96
2996−### `++cury`
2997−
2998−Curry a gate, binding the head of its sample
2999−
3000−Accepts
3001−-------
3002−
3003−`a` is a [gate]().
3004−
3005−`b` is a [noun]().
3006−
3007−Produces
3008−--------
3009−
3010−A [gate]().
3011−
3012−Source
3013−------
3014−
3015− ++ cury
3016− |* [a=_|=(^ _*) b=*]
3017− |* c=_+<+.a
3018− (a b c)
3019−
3020−Examples
3021−--------
3022−
3023− ~zod/try=> =mol (cury add 2)
3024− ~zod/try=> (mol 4)
3025− 6
3026− ~zod/try=> (mol 7)
3027− 9
3028−
3029------------------------------------------------------------------------
97------------------------------------------------------------------------
3030
98
3031−### `++curr`
3032−
3033−Right curry
3034−
3035−Right curry a gate, binding the tail of its sample
3036−
3037−Accepts
3038−-------
3039−
3040−`a` is a [gate]().
3041−
3042−`c` is a [noun]().
3043−
3044−Produces
3045−--------
3046−
3047−
3048−Source
3049−------
3050−
3051− ++ curr
3052− |* [a=_|=(^ _*) c=*]
3053− |* b=_+<+.a
3054− (a b c)
3055−
3056−Examples
3057−--------
3058−
3059− ~zod/try=> =tep (curr scan sym)
3060− ~zod/try=> `@t`(tep "asd")
3061− 'asd'
3062− ~zod/try=> `@t`(tep "lek-om")
3063− 'lek-om'
3064−
3065------------------------------------------------------------------------
99------------------------------------------------------------------------
3066
100
3067−### `++cork`
3068−Build `f` such that `(f x) .= (b (a x))`.
3069−
3070−`a` is a noun.
3071−
3072−`b` is a gate.
3073−
3074−Source
3075−------
3076−
3077− ++ cork |*([a=_,* b=gate] (corl b a)) :: compose forward
3078−
3079−Examples
3080−--------
3081−
3082− ~zod/try=> (:(cork dec dec dec) 20)
3083− 17
3084− ~zod/try=> =mal (mo (limo a/15 b/23 ~))
3085− ~zod/try=> ((cork ~(got by mal) dec) %a)
3086− 14
3087− ~zod/try=> ((cork ~(got by mal) dec) %b)
3088− 22
3089−
3090------------------------------------------------------------------------
101------------------------------------------------------------------------
3091
102
3092−### `++corl`
3093−
3094−Gate compose
3095−
3096−XX Revisit
3097−
3098−`a` is a gate.
3099−
3100−`b` is a noun.
3101−
3102−Source
3103−------
3104−
3105− ++ corl :: compose backwards
3106− |* [a=gate b=_,*]
3107− |= c=_+<.b
3108− (a (b c))
3109−
3110−Examples
3111−--------
3112−
3113− ~zod/try=> ((corl (lift bex) (slat %ud)) '2')
3114− [~ 4]
3115−
3116------------------------------------------------------------------------
103------------------------------------------------------------------------
3117
104
3118−### `++hard`
3119−
3120−Demands that a specific type be produced, crashing the program is it is
3121−not.
3122−
3123−Source
3124−------
3125−
3126− ++ hard
3127− |* han=$+(* *)
3128− |= fud=* ^- han
3129− ~| %hard
3130− =+ gol=(han fud)
3131− ?>(=(gol fud) gol)
3132−
3133−Examples
3134−--------
3135−
3136− ~zod/try=> ((hard (list)) (limo [1 2 3 ~]))
3137− ~[1 2 3]
3138− ~zod/try=> ((hard ,@) (add 2 2))
3139− 4
3140− ~zod/try=> ((hard ,@t) (crip "Tape to cord, bro!"))
3141− 'Tape to cord, bro'
3142− ~zod/try=> ((hard tape) (crip "...Tape to cord, bro?..."))
3143− ! hard
3144− ! exit
3145−
3146------------------------------------------------------------------------
105------------------------------------------------------------------------
3147
106
3148−### `++soft`
3149−
3150−Politely requests a specific type to be produced, producing null if it
3151−is not.
3152−
3153−Source
3154−------
3155−
3156− ++ soft
3157− |* han=$+(* *)
3158− |= fud=* ^- (unit han)
3159− =+ gol=(han fud)
3160− ?.(=(gol fud) ~ [~ gol])
3161−
3162−Examples
3163−--------
3164−
3165− ~zod/try=> ((soft ,%4) (add 2 2))
3166− [~ %4]
3167− ~zod/try=> ((soft ,@) (add 2 2))
3168− [~ 4]
3169− ~zod/try=> ((soft ,%5) (add 2 2))
3170− ~
3171− ~zod/try=> ((soft ,@t) (crip "Tape to cord, Woohoo!"))
3172− [~ 'Tape to cord, Woohoo!']
3173− ~zod/try=> ((soft ,@t) (trip 'Cmon man... Tape to cord? Please?!'))
3174− ~
3175−
3176------------------------------------------------------------------------
107------------------------------------------------------------------------
docs/system/hoon/library/2da.md−628
@@ -1,634 +1,6 @@
12dA sets
12dA sets
2========
2========
3
3
4−### `++apt`
5−
6−Set verification
7−
8−Produces a boolean indicating whether `a` is a [`++set`]() or not.
9−
10−Accepts
11−-------
12−
13−`a` is a [tree]().
14−
15−Produces
16−--------
17−
18−A boolean.
19−
20−Source
21−------
22−
23− ++ apt :: set invariant
24− |= a=(tree)
25− ?~ a
26− &
27− ?& ?~(l.a & ?&((vor n.a n.l.a) (hor n.l.a n.a)))
28− ?~(r.a & ?&((vor n.a n.r.a) (hor n.a n.r.a)))
29− ==
30− ::
31−
32−Examples
33−--------
34−
35− ~zod/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~])
36− ~zod/try=> (apt b)
37− %.y
38− ~zod/try=> =m (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ['c' 4] ['d' 5] ~])
39− ~zod/try=> m
40− {[p='d' q=5] [p='a' q=1] [p='c' q=4] [p='b' q=[2 3]]}
41− ~zod/try=> (apt m)
42− %.y
43−
44−------------------------------------------------------------------------
45−
46−### `++in`
47−
48−Set operations
49−
50−Core whose [arm]()s contain a variety of functions that operate on [`++set`]()s. Its [sample]() accepts the input [`++set`]() to be manipulated.
51−
52−Accepts
53−-------
54−
55−A `++set`.
56−
57−Source
58−------
59−
60− ++ in :: set engine
61− ~/ %in
62− |/ a=(set)
63−
64−Examples
65−--------
66−
67− ~zod/try=> ~(. in (sa "asd"))
68− <13.evb [nlr(^$1{@tD $1}) <414.fvk 101.jzo 1.ypj %164>]>
69−
70−### `+-all:in`
71−
72−Logical AND
73−
74−Computes the logical AND on every element in `a` slammed with `b`,
75−producing a boolean.
76−
77−Accepts
78−-------
79−
80−`a` is a [`++set`]().
81−
82−`b` is a [wet]() [gate]() that accepts a [noun]() and produces a boolean.
83−
84−Produces
85−--------
86−
87−A boolean.
88−
89−Source
90−------
91−
92− +- all :: logical AND
93− ~/ %all
94− |* b=$+(* ?)
95− |- ^- ?
96− ?~ a
97− &
98− ?&((b n.a) $(a l.a) $(a r.a))
99− ::
100−
101−Examples
102−--------
103−
104− ~zod/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
105− ~zod/try=> (~(all in b) |=(a=* ?@(+.a & |)))
106− %.n
107− ~zod/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~])
108− ~zod/try=> (~(all in b) |=(a=@t (gte a 100)))
109− %.y
110−
111−------------------------------------------------------------------------
112−
113−### `+-any:in`
114−
115−Logical OR
116−
117−Computes the logical OR on every element of `a` slammed with `b`.
118−
119−Accepts
120−-------
121−
122−`a` is a [`++set`]().
123−
124−`b` is a [gate]() that accepts a noun and produces a boolean.
125−
126−Produces
127−--------
128−
129−A boolean.
130−
131−Source
132−------
133−
134− +- any :: logical OR
135− ~/ %any
136− |* b=$+(* ?)
137− |- ^- ?
138− ?~ a
139− |
140− ?|((b n.a) $(a l.a) $(a r.a))
141− ::
142−
143−Examples
144−--------
145−
146− ~zod/try=> =b (sa `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
147− ~zod/try=> (~(any in b) |=(a=* ?@(+.a & |)))
148− %.y
149− ~zod/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~])
150− ~zod/try=> (~(any in b) |=(a=@t (lte a 100)))
151− %.n
152−
153−------------------------------------------------------------------------
154−
155−### `+-del:in`
156−
157−Remove noun
158−
159−Removes `b` from the [`++set`]() `a`.
160−
161−Accepts
162−-------
163−
164−`a` is a set.
165−
166−`b` is a [noun]().
167−
168−Produces
169−--------
170−
171−A set.
172−
173−Source
174−------
175−
176− +- del :: b without any a
177− ~/ %del
178− |* b=*
179− |- ^+ a
180− ?~ a
181− ~
182− ?. =(b n.a)
183− ?: (hor b n.a)
184− [n.a $(a l.a) r.a]
185− [n.a l.a $(a r.a)]
186− |- ^- ?(~ _a)
187− ?~ l.a r.a
188− ?~ r.a l.a
189− ?: (vor n.l.a n.r.a)
190− [n.l.a l.l.a $(l.a r.l.a)]
191− [n.r.a $(r.a l.r.a) r.r.a]
192− ::
193−
194−
195−Examples
196−--------
197−
198− ~zod/try=> =b (sa `(list ,@t)`['a' 'b' 'c' ~])
199− ~zod/try=> (~(del in b) 'a')
200− {'c' 'b'}
201− ~zod/try=> =b (sa `(list ,@t)`['john' 'bonita' 'daniel' 'madeleine' ~])
202− ~zod/try=> (~(del in b) 'john')
203− {'bonita' 'madeleine' 'daniel'}
204− ~zod/try=> (~(del in b) 'susan')
205− {'bonita' 'madeleine' 'daniel' 'john'}
206−
207------------------------------------------------------------------------
4------------------------------------------------------------------------
208
5
209−### `+-dig:in`
210−
211−Axis a in b
212−
213−Produce the axis of `b` within `a`.
214−
215−Accepts
216−-------
217−
218−`a` is a [`++set`]().
219−
220−`b` is a [noun]().
221−
222−Produces
223−--------
224−
225−The [`++unit`]() of an atom.
226−
227−Source
228−------
229−
230− +- dig :: axis of a in b
231− |= b=*
232− =+ c=1
233− |- ^- (unit ,@)
234− ?~ a ~
235− ?: =(b n.a) [~ u=(peg c 2)]
236− ?: (gor b n.a)
237− $(a l.a, c (peg c 6))
238− $(a r.a, c (peg c 7))
239− ::
240−
241−
242−Examples
243−--------
244−
245− ~zod/try=> =a (sa `(list ,@)`[1 2 3 4 5 6 7 ~])
246− ~zod/try=> a
247− {5 4 7 6 1 3 2}
248− ~zod/try=> -.a
249− n=6
250− ~zod/try=> (~(dig in a) 7)
251− [~ 12]
252− ~zod/try=> (~(dig in a) 2)
253− [~ 14]
254− ~zod/try=> (~(dig in a) 6)
255− [~ 2]
256−
257−------------------------------------------------------------------------
258−
259−### `+-gas:in`
260−
261−Concatenate
262−
263−Insert the elements of a [`++list`]() `b` into a [`++set`]() `a`.
264−
265−Accepts
266−-------
267−
268−`a` is a set.
269−
270−`b` is a list.
271−
272−Produces
273−--------
274−
275−A `++set`.
276−
277−Source
278−------
279−
280− +- gas :: concatenate
281− ~/ %gas
282− |= b=(list ,_?>(?=(^ a) n.a))
283− |- ^+ a
284− ?~ b
285− a
286− $(b t.b, a (put(+< a) i.b))
287− ::
288−
289−
290−Examples
291−--------
292−
293− ~zod/try=> b
294− {'bonita' 'madeleine' 'rudolf' 'john'}
295− ~zod/try=> (~(gas in b) `(list ,@t)`['14' 'things' 'number' '1.337' ~])
296− {'1.337' '14' 'number' 'things' 'bonita' 'madeleine' 'rudolf' 'john'}
297− ~zod/try=> (~(gas in s) `(list ,@t)`['1' '2' '3' ~])
298− {'1' '3' '2' 'e' 'd' 'a' 'c' 'b'}
299−
300−------------------------------------------------------------------------
301−
302−### `+-has:in`
303−
304−b in a?
305−
306−Checks if `b` is an element of `a`, producing a boolean.
307−
308−Accepts
309−-------
310−
311−`a` is a [`++set`]().
312−
313−`b` is a [noun]().
314−
315−Produces
316−--------
317−
318−A boolean.
319−
320−Source
321−------
322−
323− +- has :: b exists in a check
324− ~/ %has
325− |* b=*
326− |- ^- ?
327− ?~ a
328− |
329− ?: =(b n.a)
330− &
331− ?: (hor b n.a)
332− $(a l.a)
333− $(a r.a)
334− ::
335−
336−
337−Examples
338−--------
339−
340− ~zod/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~])
341− ~zod/try=> (~(has in a) `a`)
342− %.y
343− ~zod/try=> (~(has in a) 'z')
344− %.n
345−
346−------------------------------------------------------------------------
347−
348−### `+-int:in`
349−
350−Intersection
351−
352−Produces a set of the intersection between two [`++set`]()s of the same type,
353−`a` and `b`.
354−
355−Accepts
356−-------
357−
358−`a` is a set.
359−
360−`b` is a set.
361−
362−Produces
363−--------
364−
365−A [`++set`]().
366−
367−Source
368−------
369−
370− +- int :: intersection
371− ~/ %int
372− |* b=_a
373− |- ^+ a
374− ?~ b
375− ~
376− ?~ a
377− ~
378− ?. (vor n.a n.b)
379− $(a b, b a)
380− ?: =(n.b n.a)
381− [n.a $(a l.a, b l.b) $(a r.a, b r.b)]
382− ?: (hor n.b n.a)
383− %- uni(+< $(a l.a, b [n.b l.b ~])) $(b r.b)
384− %- uni(+< $(a r.a, b [n.b ~ r.b])) $(b l.b)
385−
386−
387−Examples
388−--------
389−
390− ~zod/try=> (~(int in (sa "ac")) (sa "ha"))
391− {~~a}
392− ~zod/try=> (~(int in (sa "acmo")) ~)
393− {}
394− ~zod/try=> (~(int in (sa "acmo")) (sa "ham"))
395− {~~a ~~m}
396− ~zod/try=> (~(int in (sa "acmo")) (sa "lep"))
397− {}
398−
399−------------------------------------------------------------------------
400−
401−### `+-put:in`
402−
403−Put b in a
404−
405−Add an element `b` to the [`++set`]() `a`.
406−
407−Accepts
408−-------
409−
410−`a` is a set.
411−
412−`b` is a [noun]().
413−
414−Produces
415−--------
416−
417−A [`++set`]().
418−
419−Source
420−------
421−
422− +- put :: puts b in a
423− ~/ %put
424− |* b=*
425− |- ^+ a
426− ?~ a
427− [b ~ ~]
428− ?: =(b n.a)
429− a
430− ?: (hor b n.a)
431− =+ c=$(a l.a)
432− ?> ?=(^ c)
433− ?: (vor n.a n.c)
434− [n.a c r.a]
435− [n.c l.c [n.a r.c r.a]]
436− =+ c=$(a r.a)
437− ?> ?=(^ c)
438− ?: (vor n.a n.c)
439− [n.a l.a c]
440− [n.c [n.a l.a l.c] r.c]
441− ::
442−
443−
444−Examples
445−--------
446−
447− ~zod/try=> =a (~(gas in `(set ,@t)`~) `(list ,@t)`[`a` `b` `c` ~])
448− ~zod/try=> =b (~(put in a) `d`)
449− ~zod/try=> b
450− {`d` `a` `c` `b`}
451− ~zod/try=> -.l.+.b
452− n=`d`
453−
454−------------------------------------------------------------------------
455−
456−### `+-rep:in`
457−
458−Accumulate
459−
460−Accumulate the elements of `a` using a [gate]() `c` and an accumulator `b`.
461−
462−Accepts
463−--------
464−
465−`a` is a [`++set`]().
466−
467−`b` is a [noun]().
468−
469−`c` is a gate.
470−
471−Produces
472−--------
473−
474−A noun.
475−
476−Source
477−------
478−
479− +- rep :: replace by tile
480− |* [b=* c=_,*]
481− |-
482− ?~ a b
483− $(a r.a, b $(a l.a, b (c n.a b)))
484− ::
485−
486−
487−Examples
488−--------
489−
490− ~zod/try=> =a (~(gas in *(set ,@)) [1 2 3 ~])
491− ~zod/try=> a
492− {1 3 2}
493− ~zod/try=> (~(rep in a) 0 |=([a=@ b=@] (add a b)))
494− 6
495−
496−------------------------------------------------------------------------
497−
498−### `+-tap:in`
499−
500−Set to list
501−
502−Flattens the [`++set`]() `a` into a [`++list`]().
503−
504−Accepts
505−-------
506−
507−`a` is an set.
508−
509−Produces
510−--------
511−
512−A list.
513−
514−Source
515−------
516−
517− +- tap :: list tiles a set
518− ~/ %tap
519− |= b=(list ,_?>(?=(^ a) n.a))
520− ^+ b
521− ?~ a
522− b
523− $(a r.a, b [n.a $(a l.a)])
524− ::
525−
526−
527−Examples
528−--------
529−
530− ~zod/try=> =s (sa `(list ,@t)`['a' 'b' 'c' 'd' 'e' ~])
531− ~zod/try=> s
532− {'e' 'd' 'a' 'c' 'b'}
533− ~zod/try=> (~(tap in s) `(list ,@t)`['1' '2' '3' ~])
534− ~['b' 'c' 'a' 'd' 'e' '1' '2' '3']
535− ~zod/try=> b
536− {'bonita' 'madeleine' 'daniel' 'john'}
537− ~zod/try=> (~(tap in b) `(list ,@t)`['david' 'people' ~])
538− ~['john' 'daniel' 'madeleine' 'bonita' 'david' 'people']
539−
540−------------------------------------------------------------------------
541−
542−### `+-uni:in`
543−
544−Union
545−
546−Produces a set of the union between two [`++set`]()s of the same type, `a` and
547−`b`.
548−
549−Accepts
550−-------
551−
552−`a` is a set.
553−
554−`b` is a set.
555−
556−Produces
557−--------
558−
559−A set.
560−
561−Source
562−------
563−
564− +- uni :: union
565− ~/ %uni
566− |* b=_a
567− |- ^+ a
568− ?~ b
569− a
570− ?~ a
571− b
572− ?: (vor n.a n.b)
573− ?: =(n.b n.a)
574− [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
575− ?: (hor n.b n.a)
576− $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
577− $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
578− ?: =(n.a n.b)
579− [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
580− ?: (hor n.a n.b)
581− $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
582− $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
583−
584−
585−Examples
586−--------
587−
588− ~zod/try=> (~(uni in (sa "ac")) (sa "ha"))
589− {~~a ~~c ~~h}
590− ~zod/try=> (~(uni in (sa "acmo")) ~)
591− {~~a ~~c ~~m ~~o}
592− ~zod/try=> (~(uni in (sa "acmo")) (sa "ham"))
593− {~~a ~~c ~~m ~~o ~~h}
594− ~zod/try=> (~(uni in (sa "acmo")) (sa "lep"))
595− {~~e ~~a ~~c ~~m ~~l ~~o ~~p}
596−
597−------------------------------------------------------------------------
598−
599−### `+-wyt:in`
600−
601−Set size
602−
603−Produce the number of elements in [`++set`]() `a` as an atom.
604−
605−Accepts
606−-------
607−
608−`a` is an set.
609−
610−Produces
611−--------
612−
613−An atom.
614−
615−Source
616−------
617−
618− +- wyt :: size of set
619− |- ^- @
620− ?~(a 0 +((add $(a l.a) $(a r.a))))
621−
622−
623−Examples
624−--------
625−
626− ~zod/try=> =a (~(put in (~(put in (sa)) 'a')) 'b')
627− ~zod/try=> ~(wyt in a)
628− 2
629− ~zod/try=> b
630− {'bonita' 'madeleine' 'daniel' 'john'}
631− ~zod/try=> ~(wyt in b)
632− 4
633−
634------------------------------------------------------------------------
6------------------------------------------------------------------------
docs/system/hoon/library/2db.md−805
@@ -1,813 +1,8 @@
12dB maps
12dB maps
2========
2========
3
3
4−### `++ept`
5−
6−Map invariant.
7−
8− ++ ept :: map invariant
9− |= a=(tree ,[p=* q=*])
10− ?~ a
11− &
12− ?& ?~(l.a & ?&((vor p.n.a p.n.l.a) (hor p.n.l.a p.n.a)))
13− ?~(r.a & ?&((vor p.n.a p.n.r.a) (hor p.n.a p.n.r.a)))
14− ==
15−
16−Computes whether `a` is a [map](), producing a loobean.
17−
18−`a` is a [tree]().
19−
20− ~zod/try=> m
21− {[p='d' q=5] [p='a' q=1] [p='c' q=4] [p='b' q=[2 3]]}
22− ~zod/try=> (ept m)
23− %.y
24− ~zod/try=> b
25− {'bonita' 'madeleine' 'daniel' 'john'}
26− ~zod/try=> (ept b)
27− ! type-fail
28− ! exit
29−
30−------------------------------------------------------------------------
31−
32−### `++ja`
33−
34−Jar engine
35−
36− ++ ja :: jar engine
37− |/ a=(jar)
38−
39−A container arm for `++jar` operation arms. A `++jar` is a `++map` of
40−`++list`s. The contained arms inherit the [sample]() jar.
41−
42−`a` is a [jar]().
43−
44− ~zod/try=> ~(. ja (mo (limo a/"ho" b/"he" ~)))
45− <2.dgz [nlr([p={%a %b} q=""]) <414.fvk 101.jzo 1.ypj %164>]>
46−
47−------------------------------------------------------------------------
48−
49−### `+-get:ja`
50−
51−Grab value by key
52−
53− +- get :: grab value by key
54− |* b=*
55− =+ c=(~(get by a) b)
56− ?~(c ~ u.c)
57−
58−Produces a list retrieved from jar `a` using the key `b`.
59−
60−`a` is a [`++jar`](/doc/hoon/library/1#++jar).
61−
62−`b` is a key of the same type as the keys in `a`.
63−
64− ~zod/try=> =l (mo `(list ,[@t (list ,@)])`[['a' `(list ,@)`[1 2 3 ~]] ['b' `(list ,@)`[4 5 6 ~]] ~])
65− ~zod/try=> l
66− {[p='a' q=~[1 2 3]] [p='b' q=~[4 5 6]]}
67− ~zod/try=> (~(get ja l) 'a')
68− ~[1 2 3]
69− ~zod/try=> (~(get ja l) 'b')
70− ~[4 5 6]
71− ~zod/try=> (~(get ja l) 'c')
72− ~
73−
74−------------------------------------------------------------------------
75−
76−### `+-add:ja`
77−
78−Prepend to list
79−
80− +- add :: adds key-list pair
81− |* [b=* c=*]
82− =+ d=(get(+< a) b)
83− (~(put by a) b [c d])
84−
85−Produces jar `a` with value `c` prepended to the list located at key
86−`b`.
87−
88−`a` is a [jar]().
89−
90−`b` is a key of the same type as the keys in `a`.
91−
92−`c` is a value of the same type as the values in `a`.
93−
94− ~zod/try=> =l (mo `(list ,[@t (list ,@)])`[['a' `(list ,@)`[1 2 3 ~]] ['b' `(list ,@)`[4 5 6 ~]] ~])
95− ~zod/try=> l
96− {[p='a' q=~[1 2 3]] [p='b' q=~[4 5 6]]}
97− ~zod/try=> (~(add ja l) 'b' 7)
98− {[p='a' q=~[1 2 3]] [p='b' q=~[7 4 5 6]]}
99− ~zod/try=> (~(add ja l) 'a' 100)
100− {[p='a' q=~[100 1 2 3]] [p='b' q=~[4 5 6]]}
101− ~zod/try=> (~(add ja l) 'c' 7)
102− {[p='a' q=~[1 2 3]] [p='c' q=~[7]] [p='b' q=~[4 5 6]]}
103− ~zod/try=> (~(add ja l) 'c' `(list ,@)`[7 8 9 ~])
104− ! type-fail
105− ! exit
106−
107−------------------------------------------------------------------------
108−
109−### `++ju`
110−
111−Jug operations
112−
113− ++ ju :: jug engine
114− |/ a=(jug)
115−
116−Container arm for jug operation arms. A `++jug` is a `++map` of
117−`++sets`. The contained arms inherit its [sample]() jug, `a`.
118−
119−`a` is a [jug]().
120−
121− ~zod/try=> ~(. ju (mo (limo a/(sa "ho") b/(sa "he") ~)))
122− <2.dgz [nlr([p={%a %b} q={nlr(^$1{@tD $1}) nlr(^$3{@tD $3})}]) <414.fvk 101.jzo 1.ypj %164>]>
123−
124−### `+-del:ju`
125−
126−Remove
127−
128− +- del :: delete at key b
129− |* [b=* c=*]
130− ^+ a
131− =+ d=(get(+< a) b)
132− =+ e=(~(del in d) c)
133− ?~ e
134− (~(del by a) b)
135− (~(put by a) b e)
136−
137−Produces jug `a` with value `c` removed from set located at key `b`.
138−
139−`a` is a [jug]().
140−
141−`b` is a key of the same type as the keys in `a`.
142−
143−`c` is the value of the same type of the keys in `a` that is to be
144−removed.
145−
146− ~zod/try=> s
147− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
148− ~zod/try=> (~(del ju s) 'a' 1)
149− {[p='a' q={3 2}] [p='b' q={5 4 6}]}
150− ~zod/try=> (~(del ju s) 'c' 7)
151− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
152−
153−------------------------------------------------------------------------
154−
155−### `+-get:ju`
156−
157−Retrieve set
158−
159− +- get :: gets set by key
160− |* b=*
161− =+ c=(~(get by a) b)
162− ?~(c ~ u.c)
163−
164−Produces a set retrieved from jar `a` using key `b`.
165−
166−`a` is a [jar]().
167−
168−`b` is a key of the same type as the keys in `a`.
169−
170− ~zod/try=> s
171− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
172− ~zod/try=> (~(get ju s) 'a')
173− {1 3 2}
174− ~zod/try=> (~(get ju s) 'b')
175− {5 4 6}
176− ~zod/try=> (~(get ju s) 'c')
177− ~
178−
179−------------------------------------------------------------------------
180−
181−### `+-has:ju`
182−
183−Check contents
184−
185− +- has :: existence check
186− |* [b=* c=*]
187− ^- ?
188− (~(has in (get(+< a) b)) c)
189−
190−Computes whether a value `c` exists within the set located at key `b`
191−with jar `a`. Produces a loobean.
192−
193−`a` is a [set]().
194−
195−`b` is a key as a [noun]().
196−
197−`c` is a value as a [noun]().
198−
199− ~zod/try=> s
200− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
201− ~zod/try=> (~(has ju s) 'a' 3)
202− %.y
203− ~zod/try=> (~(has ju s) 'b' 6)
204− %.y
205− ~zod/try=> (~(has ju s) 'a' 7)
206− %.n
207− ~zod/try=> (~(has jus s) 'c' 7)
208− ! -find-limb.jus
209− ! find-none
210− ! exit
211− ~zod/try=> (~(has ju s) 'c' 7)
212− %.n
213−
214−------------------------------------------------------------------------
215−
216−### `+-put:ju`
217−
218−Add key-set pair
219−
220− +- put :: adds key-element pair
221− |* [b=* c=*]
222− ^+ a
223− =+ d=(get(+< a) b)
224− (~(put by a) b (~(put in d) c))
225−
226−Produces jar `a` with `c` added to the set value located at key `b`.
227−
228−`a` is a [set]().
229−
230−`b` is a key as a [noun]().
231−
232−`c` is a [value]().
233−
234− ~zod/try=> s
235− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
236− ~zod/try=> (~(put ju s) 'a' 7)
237− {[p='a' q={7 1 3 2}] [p='b' q={5 4 6}]}
238− ~zod/try=> (~(put ju s) 'a' 1)
239− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
240− ~zod/try=> (~(put ju s) 'c' 7)
241− {[p='a' q={1 3 2}] [p='c' q={7}] [p='b' q={5 4 6}]}
242−
243−------------------------------------------------------------------------
244−
245−### `++by`
246−
247−Map operations
248−
249− ++ by :: map engine
250− ~/ %by
251− |/ a=(map)
252−
253−Container arm for map operation arms. A map is a set of key, value
254−pairs. The contained arms inherit it's [sample]() [map](), `a`.
255−
256−`a` is a [map]().
257−
258− ~zod/try=> ~(. by (mo (limo [%a 1] [%b 2] ~)))
259− <19.irb [nlr([p={%a %b} q=@ud]) <414.rvm 101.jzo 1.ypj %164>]>
260−
261−------------------------------------------------------------------------
262−
263−### `+-all:by`
264−
265−Logical AND
266−
267− +- all :: logical AND
268− ~/ %all
269− |* b=$+(* ?)
270− |- ^- ?
271− ?~ a
272− &
273− ?&((b q.n.a) $(a l.a) $(a r.a))
274−
275−Computes the logical AND on the results of slamming every element in map
276−`a` with gate `b`. Produces a loobean.
277−
278−`a` is a [map]().
279−
280−`b` is a [wet gate]().
281−
282− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
283− ~zod/try=> (~(all by b) |=(a=* ?@(a & |)))
284− %.n
285− ~zod/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
286− ~zod/try=> (~(all by a) |=(a=@ (lte a 6)))
287− %.y
288− ~zod/try=> (~(all by a) |=(a=@ (lte a 4)))
289− %.n
290−
291−------------------------------------------------------------------------
292−
293−### `+-any:by`
294−
295−Logical OR
296−
297− +- any :: logical OR
298− ~/ %any
299− |* b=$+(* ?)
300− |- ^- ?
301− ?~ a
302− |
303− ?|((b q.n.a) $(a l.a) $(a r.a))
304−
305−Computes the logical OR on the results of slamming every element with
306−gate `b`. Produces a loobean.
307−
308−`a` is a [map]().
309−
310−`b` is a [wet gate]().
311−
312− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
313− ~zod/try=> (~(all by b) |=(a=* ?@(a & |)))
314− %.y
315− ~zod/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
316− ~zod/try=> (~(any by a) |=(a=@ (lte a 4)))
317− %.y
318−
319−------------------------------------------------------------------------
320−
321−### `+-del:by`
322−
323−Delete
324−
325− +- del :: delete at key b
326− ~/ %del
327− |* b=*
328− |- ^+ a
329− ?~ a
330− ~
331− ?. =(b p.n.a)
332− ?: (gor b p.n.a)
333− [n.a $(a l.a) r.a]
334− [n.a l.a $(a r.a)]
335− |- ^- ?(~ _a)
336− ?~ l.a r.a
337− ?~ r.a l.a
338− ?: (vor p.n.l.a p.n.r.a)
339− [n.l.a l.l.a $(l.a r.l.a)]
340− [n.r.a $(r.a l.r.a) r.r.a]
341−
342−Produces map `a` with the element located at key `b` removed.
343−
344−`a` is a [map]().
345−
346−`b` is a key as a [noun]().
347−
348− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
349− ~zod/try=> (~(del by b) `a`)
350− {[p=`b` q=[2 3]]}
351−
352−------------------------------------------------------------------------
353−
354−### `+-dig:by`
355−
356−Axis of key
357−
358− +- dig :: axis of key
359− |= b=*
360− =+ c=1
361− |- ^- (unit ,@)
362− ?~ a ~
363− ?: =(b p.n.a) [~ u=(peg c 2)]
364− ?: (gor b p.n.a)
365− $(a l.a, c (peg c 6))
366− $(a r.a, c (peg c 7))
367−
368−Produce the axis of key `b` within map `a`.
369−
370−`a` is a [map]().
371−
372−`b` is a key as a [noun]().
373−
374− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
375− ~zod/try=> (~(dig by b) `b`)
376− [~ 2]
377−
378−------------------------------------------------------------------------
379−
380−### `+-gas:by`
381−
382−Concatenate
383−
384− +- gas :: concatenate
385− ~/ %gas
386− |* b=(list ,[p=* q=*])
387− => .(b `(list ,_?>(?=(^ a) n.a))`b)
388− |- ^+ a
389− ?~ b
390− a
391− $(b t.b, a (put(+< a) p.i.b q.i.b))
392−
393−Insert a list of key-value pairs `b` into map `a`.
394−
395−`a` is a [map]().
396−
397−`b` is a [list]() of [cells]() of key-value nouns `p` and `q`.
398−
399− ~zod/try=> =a (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~])
400− ~zod/try=> =b `(list ,[@t *])`[[`c` 3] [`d` 4] ~]
401− ~zod/try=> (~(gas by a) b)
402− {[p=`d` q=4] [p=`a` q=1] [p=`c` q=3] [p=`b` q=2]}
403−
404−------------------------------------------------------------------------
405−
406−### `+-get:by`
407−
408−Grab unit value
409−
410− +- get :: unit value by key
411− ~/ %get
412− |* b=*
413− |- ^- ?(~ [~ u=_?>(?=(^ a) q.n.a)])
414− ?~ a
415− ~
416− ?: =(b p.n.a)
417− [~ u=q.n.a]
418− ?: (gor b p.n.a)
419− $(a l.a)
420− $(a r.a)
421−
422−Produce the unit value of the value located at key `b` within map `a`.
423−
424−`a` is a [map]()
425−
426−`b` is a [key]() as a [noun]()
427−
428− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
429− ~zod/try=> (~(get by b) `b`)
430− [~ [2 3]]
431−
432−------------------------------------------------------------------------
433−
434−### `+-got:by`
435−
436−Assert
437−
438− +- got
439− |* b=*
440− %- need
441− %- get(+< a) b
442−
443−Produce the value located at key `b` within map `a`. Crash if key `b`
444−does not exist.
445−
446−`a` is a [map]().
447−
448−`b` is a [key]().
449−
450− ~zod/try=> =m (mo `(list ,[@t *])`[['a' 1] ['b' 2] ~])
451− ~zod/try=> m
452− {[p='a' q=1] [p='b' q=2]}
453− ~zod/try=> (~(get by m) 'a')
454− [~ 1]
455− ~zod/try=> (~(got by m) 'a')
456− 1
457− ~zod/try=> (~(got by m) 'c')
458− ! exit
459−
460------------------------------------------------------------------------
4------------------------------------------------------------------------
461
5
462−### `+-has:by`
463−
464−Key existence check
465−
466− +- has :: key existence check
467− ~/ %has
468− |* b=*
469− !=(~ (get(+< a) b))
470−
471−Checks whether map `a` contains an element with key `b`, producing a
472−loobean.
473−
474−`a` is a [map]().
475−
476−`b` is a key as a [noun]().
477−
478− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
479− ~zod/try=> (~(has by b) `b`)
480− %.y
481− ~zod/try=> (~(has by b) `c`)
482− %.n
483−
484−------------------------------------------------------------------------
485−
486−### `+-int:by`
487−
488−Intersection
489−
490− +- int :: intersection
491− ~/ %int
492− |* b=_a
493− |- ^+ a
494− ?~ b
495− ~
496− ?~ a
497− ~
498− ?: (vor p.n.a p.n.b)
499− ?: =(p.n.b p.n.a)
500− [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
501− ?: (hor p.n.b p.n.a)
502− %- uni(+< $(a l.a, b [n.b l.b ~])) $(b r.b)
503− %- uni(+< $(a r.a, b [n.b ~ r.b])) $(b l.b)
504− ?: =(p.n.a p.n.b)
505− [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
506− ?: (hor p.n.a p.n.b)
507− %- uni(+< $(b l.b, a [n.a l.a ~])) $(a r.a)
508− %- uni(+< $(b r.b, a [n.a ~ r.a])) $(a l.a)
509−
510−Produces a map of the (key) intersection between two maps of the same
511−type, `a` and `b`. If both maps have an identical key that point to
512−different values, the element from map `b` is used.
513−
514−`a` is a [map]().
515−
516−`b` is a [map]().
517−
518− ~zod/try=> =n (mo `(list ,[@t *])`[['a' 1] ['c' 3] ~])
519− ~zod/try=> n
520− {[p='a' q=1] [p='c' q=3]}
521− ~zod/try=> m
522− {[p='a' q=1] [p='b' q=2]}
523− ~zod/try=> (~(int by m) n)
524− {[p='a' q=1]}
525− ~ravpel-holber/try=> =p (mo `(list ,[@t *])`[['a' 2] ['b' 2] ~])
526− ~zod/try=> p
527− {[p='a' q=2] [p='b' q=2]}
528− ~zod/try=> (~(int by p) n)
529− {[p='a' q=2]}
530− ~zod/try=> =q (mo `(list ,[@t *])`[['a' 2] ['c' 2] ~])
531− ~zod/try=> q
532− {[p='a' q=2] [p='b' q=2]}
533− ~zod/try=> (~(int by p) q)
534− {[p='a' q=2] [p='b' q=2]}
535− ~zod/try=> =o (mo `(list ,[@t *])`[['c' 3] ['d' 4] ~])
536− ~zod/try=> (~(int by m) o)
537− {}
538−
539−
540------------------------------------------------------------------------
6------------------------------------------------------------------------
541
7
542−### `+-mar:by`
543−
544−Assert and Add
545−
546− +- mar :: add with validation
547− |* [b=_?>(?=(^ a) p.n.a) c=(unit ,_?>(?=(^ a) q.n.a))]
548− ?~ c
549− (del b)
550− (put b u.c)
551−
552−Produces map `a` with the addition of a key-value pair, where the value
553−is a nonempty unit.
554−
555−Accept a noun and a unit of a noun of the type of the map's keys and
556−values, respectively. Validate that the value is not null and put the
557−pair in the map. If the value is null, delete the key.
558−
559−XX This arm is broken, asana task 15186618346453
560−
561− ~zod/try=> m
562− {[p='a' q=1] [p='b' q=2]}
563− ~zod/try=> (~(mar by m) 'c' (some 3))
564− ! -find-limb.n
565− ! find-none
566− ! exit
567− ~zod/try=> (~(mar by m) 'c' ~)
568− ! -find-limb.n
569− ! find-none
570− ! exit
571− ~zod/try=> (~(mar by m) 'b' ~)
572− ! -find-limb.n
573− ! find-none
574− ! exit
575−
576−------------------------------------------------------------------------
577−
578−### `+-put:by`
579−
580−Add key-value pair
581−
582− +- put :: adds key-value pair
583− ~/ %put
584− |* [b=* c=*]
585− |- ^+ a
586− ?~ a
587− [[b c] ~ ~]
588− ?: =(b p.n.a)
589− ?: =(c q.n.a)
590− a
591− [[b c] l.a r.a]
592− ?: (gor b p.n.a)
593− =+ d=$(a l.a)
594− ?> ?=(^ d)
595− ?: (vor p.n.a p.n.d)
596− [n.a d r.a]
597− [n.d l.d [n.a r.d r.a]]
598− =+ d=$(a r.a)
599− ?> ?=(^ d)
600− ?: (vor p.n.a p.n.d)
601− [n.a l.a d]
602− [n.d [n.a l.a l.d] r.d]
603−
604−Produces `a` with the addition of the key-value pair of `b` and `c`.
605−
606−`a` is a [map]().
607−
608−`b` is a key of the same type as the keys in `a`.
609−
610−`c` is a value of the same type of the values in `a`.
611−
612− ~zod/try=> m
613− {[p='a' q=1] [p='b' q=2]}
614− ~zod/try=> (~(put by m) 'c' 3)
615− {[p='a' q=1] [p='c' q=3] [p='b' q=2]}
616− ~zod/try=> (~(put by m) "zod" 26)
617− ! type-fail
618− ! exit
619− ~zod/try=> (~(put by m) 'a' 2)
620− {[p='a' q=2] [p='b' q=2]}
621−
622−------------------------------------------------------------------------
623−
624−### `+-rep:by`
625−
626− +- rep :: replace by product
627− |* [b=* c=_,*]
628− |-
629− ?~ a b
630− $(a r.a, b $(a l.a, b (c q.n.a b)))
631−
632−Accumulate using gate from values in map
633−
634−XX interface changing.
635−
636−------------------------------------------------------------------------
637−
638−### `+-rib:by`
639−
640− +- rib :: transform + product
641− |* [b=* c=_,*]
642− |- ^+ [b a]
643− ?~ a [b ~]
644− =+ d=(c n.a b)
645− =. n.a +.d
646− =+ e=$(a l.a, b -.d)
647− =+ f=$(a r.a, b -.e)
648− [-.f [n.a +.e +.f]]
649−
650−Replace values with accumulator
651−
652−XX interface changing, possibly disappearing
653−
654−------------------------------------------------------------------------
655−
656−### `+-run:by`
657−
658−Transform values
659−
660− +- run :: turns to tuples
661− |* b=_,*
662− |-
663− ?~ a a
664− a(n (b q.n.a), l $(a l.a), r $(a r.a))
665−
666−Iterates over every value in set `a` using gate `b`. Produces a map.
667−
668−`a` is a [map]().
669−
670−`b` is a [wet gate]().
671−
672− ~zod/try=> m
673− {[p='a' q=1] [p='b' q=2]}
674− ~zod/try=> ^+(m (~(run by m) dec))
675− {[p='a' q=0] [p='b' q=1]}
676− ~zod/try=> `(map ,@tas ,@t)`(~(run by m) (cury scot %ux))
677− {[p=%a q='0x1'] [p=%b q='0x2']}
678−
679−------------------------------------------------------------------------
680−
681−### `+-tap:by`
682−
683−Listify pairs
684−
685− +- tap :: listify pairs
686− ~/ %tap
687− |= b=(list ,_?>(?=(^ a) n.a))
688− ^+ b
689− ?~ a
690− b
691− $(a r.a, b [n.a $(a l.a)])
692−
693−Produces the list of all elements in map `a` that is prepended to list
694−`b`, which is empty by default.
695−
696−`a` is a [map]().
697−
698−`b` is a [list]().
699−
700− {[p='a' q=1] [p='b' q=2]}
701− ~zod/try=> `*`m
702− [[98 2] [[97 1] 0 0] 0]
703− ~zod/try=> (~(tap by m))
704− ~[[p='b' q=2] [p='a' q=1]]
705− ~zod/try=> `*`(~(tap by m))
706− [[98 2] [97 1] 0]
707−
708−------------------------------------------------------------------------
709−
710−### `+-uni:by`
711−
712−Union
713−
714− +- uni :: union, merge
715− ~/ %uni
716− |* b=_a
717− |- ^+ a
718− ?~ b
719− a
720− ?~ a
721− b
722− ?: (vor p.n.a p.n.b)
723− ?: =(p.n.b p.n.a)
724− [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
725− ?: (hor p.n.b p.n.a)
726− $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
727− $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
728− ?: =(p.n.a p.n.b)
729− [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
730− ?: (hor p.n.a p.n.b)
731− $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
732− $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
733−
734−Produces a map of the union between the keys of `a` and `b`. If `b`
735−shares a key with `a`, the tuple from `a` is preserved.
736−
737−`a` is a [map]().
738−
739−`b` is a [map]().
740−
741− ~zod/try=> m
742− {[p='a' q=1] [p='b' q=2]}
743− ~zod/try=> o
744− {[p='d' q=4] [p='c' q=3]}
745− ~zod/try=> (~(uni by m) o)
746− {[p='d' q=4] [p='a' q=1] [p='c' q=3] [p='b' q=2]}
747− ~zod/try=> (~(uni by m) ~)
748− {[p='a' q=1] [p='b' q=2]}
749− ~zod/try=> n
750− {[p='a' q=1] [p='c' q=9]}
751− ~zod/try=> (~(uni by o) n)
752− {[p='d' q=4] [p='a' q=1] [p='c' q=3]}
753− ~zod/try=> =n (mo `(list ,[@t *])`[['a' 1] ['c' 9] ~])
754− ~zod/try=> n
755− {[p='a' q=1] [p='c' q=9]}
756− ~zod/try=> (~(uni by o) n)
757− {[p='d' q=4] [p='a' q=1] [p='c' q=9]}
758−
759−------------------------------------------------------------------------
760−
761−### `+-urn:by`
762−
763−Turn (with key)
764−
765− +- urn :: turn
766− |* b=$+([* *] *)
767− |-
768− ?~ a ~
769− [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
770−
771−Iterates over every value in map `a` using gate `b`, which accepts both
772−the key and the value of each element as its sample.
773−
774−`a` is a [map]().
775−
776−`b` is a [wet gate]() that accepts two nouns (a key and a value) and
777−produces a noun (the new value).
778−
779− ~zod/try=> m
780− {[p='a' q=1] [p='b' q=2]}
781− ~zod/try=> (~(urn by m) |=(a=[p=* q=*] q.a))
782− {[p='a' q=1] [p='b' q=2]}
783− ~zod/try=> (~(urn by m) |=(a=[p=* q=*] 7))
784− {[p='a' q=7] [p='b' q=7]}
785− ~zod/try=> (~(urn by m) |=(a=[p=* q=*] p.a))
786− {[p='a' q=97] [p='b' q=98]}
787−
788−------------------------------------------------------------------------
789−
790−### `+-wyt:by`
791−
792−Depth
793−
794− +- wyt :: depth of map
795− |- ^- @
796− ?~(a 0 +((add $(a l.a) $(a r.a))))
797−
798−Produce the depth of the tree map `a`.
799−
800−`a` is a [map]().
801−
802− ~zod/try=> m
803− {[p='a' q=1] [p='b' q=2]}
804− ~zod/try=> o
805− {[p='d' q=4] [p='c' q=3]}
806− ~zod/try=> ~(wyt by m)
807− 2
808− ~zod/try=> ~(wyt by o)
809− 2
810− ~zod/try=> ~(wyt by (~(uni by m) o))
811− 4
812−
813------------------------------------------------------------------------
8------------------------------------------------------------------------
docs/system/hoon/library/2dc.md−330
@@ -1,334 +1,4 @@
12dC queues
12dC queues
2==========
2==========
3
3
4−### `++to`
5−
6−Queue operations
7−
8−Container arm for queue operation arms. The contained arms inherit its
9−[sample]() `++qeu` `a`.
10−
11−Accepts
12−-------
13−
14−`a` is a queue, [++qeu]().
15−
16−Source
17−------
18−
19− ++ to :: queue engine
20− |/ a=(qeu)
21−
22−### `+-bal:to`
23−
24−Balance
25−
26−Vertically rebalances queue `a`.
27−
28−Accepts
29−-------
30−
31−`a` is a [queue]().
32−
33−Produces
34−--------
35−
36−A [queue]().
37−
38−Source
39−------
40−
41− +- bal
42− |- ^+ a
43− ?~ a ~
44− ?. |(?=(~ l.a) (vor n.a n.l.a))
45− $(a [n.l.a l.l.a $(a [n.a r.l.a r.a])])
46− ?. |(?=(~ r.a) (vor n.a n.r.a))
47− $(a [n.r.a $(a [n.a l.a l.r.a]) r.r.a])
48− a
49− ::
50−
51−Examples
52−--------
53−
54− ~zod/try=> `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
55− {"a" "b" "c" "d" "e" "f" "g"}
56− ~zod/try=> `*`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
57− [[97 0] 0 [98 0] 0 [99 0] 0 [100 0] 0 [101 0] 0 [102 0] 0 [103 0] 0 0]
58− ~zod/try=> ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
59− {"a" "b" "c" "d" "e" "f" "g"}
60− ~zod/try=> `*`~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
61− [[100 0] [[99 0] [[98 0] [[97 0] 0 0] 0] 0] [101 0] 0 [102 0] 0 [103 0] 0 0]
62−
63−------------------------------------------------------------------------
64−
65−### `+-dep:to`
66−
67−Maximum Depth
68−
69−Produces the maximum depth of leaves (r.a and l.a) in queue `a`.
70−
71−Accepts
72−-------
73−
74−`a` is a [queue]().
75−
76−Produces
77−--------
78−
79−An atom.
80−
81−Source
82−------
83−
84− +- dep :: max depth of queue
85− |- ^- @
86− ?~ a 0
87− +((max $(a l.a) $(a r.a)))
88− ::
89−
90−Examples
91−--------
92−
93− ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 7 ~])
94− ~zod/try=> ~(dep to a)
95− 4
96− ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 ~])
97− ~zod/try=> ~(dep to a)
98− 3
99− ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 ~])
100− ~zod/try=> ~(dep to a)
101− 2
102− ~zod/try=> ~(dep to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
103− 7
104− ~zod/try=> ~(dep to ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]))
105− 4
106−
107−------------------------------------------------------------------------
108−
109−### `+-gas`
110−
111−Push list
112−
113−Push all elements of [`++list`]() `b` into the [`++queue`]().
114−
115−Accepts
116−-------
117−
118−`a` is a queue.
119−
120−`b` is a list.
121−
122−Produces
123−--------
124−
125−A queue.
126−
127−Source
128−------
129−
130− +- gas :: insert list to queue
131− |= b=(list ,_?>(?=(^ a) n.a))
132− |- ^+ a
133− ?~(b a $(b t.b, a (put(+< a) i.b)))
134− ::
135−
136−Examples
137−--------
138−
139− ~zod/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
140− {3 2 1}
141− ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
142− ~zod/try=> =b `(list ,@)`[4 5 6 ~]
143− ~zod/try=> (~(gas to a) b)
144− {6 5 4 3 2 1}
145−
146−------------------------------------------------------------------------
147−
148−### `+-get:to`
149−
150−Pop
151−
152−Produces the head and tail [`++queue`]() of `a`.
153−
154−Accepts
155−-------
156−
157−`a` is a queue.
158−
159−Produces
160−--------
161−
162−The last element in `a` along with the rest of queue `a`.
163−
164−Source
165−------
166−
167− +- get :: head-tail pair
168− |- ^+ [p=?>(?=(^ a) n.a) q=a]
169− ?~ a
170− !!
171− ?~ r.a
172− [n.a l.a]
173− =+ b=$(a r.a)
174− :- p.b
175− ?: |(?=(~ q.b) (vor n.a n.q.b))
176− [n.a l.a q.b]
177− [n.q.b [n.a l.a l.q.b] r.q.b]
178− ::
179−
180−Examples
181−--------
182−
183− ~zod/try=> =s (~(gas to *(qeu ,@)) `(list ,@)`~[1 2 3])
184− ~zod/try=> ~(get to s)
185− [p=1 q={3 2}]
186− ~zod/try=> ~(get to ~)
187− ! exit
188−
189−------------------------------------------------------------------------
190−
191−### `+-nap:to`
192−
193−Remove last element
194−
195−Removes the head of [`++queue`]() `a`, producing the resulting queue.
196−
197−Accepts
198−-------
199−
200−`a` is a [queue]().
201−
202−Produces
203−--------
204−
205−A queue.
206−
207−Source
208−------
209−
210− +- nap :: removes head
211− ?> ?=(^ a)
212− ?: =(~ l.a) r.a
213− =+ b=get(+< l.a)
214− bal(+< ^+(a [p.b q.b r.a]))
215− ::
216−
217−Examples
218−--------
219−
220− ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~])
221− ~zod/try=> -.a
222− n=6
223− ~zod/try=> =b ~(nap to a)
224− ~zod/try=> -.b
225− n=2
226− ~zod/try=> b
227− {5 4 3 2 1}
228− ~zod/try=> a
229− {6 5 4 3 2 1}
230−
231−------------------------------------------------------------------------
232−
233−### `+-put:to`
234−
235−Insert
236−
237−Accept any [noun]() `b` and adds to [`++queue`]() `a` as the head, producing the
238−resulting queue.
239−
240−Accepts
241−-------
242−
243−`a` is a [queue]().
244−
245−`b` is any noun.
246−
247−Produces
248−--------
249−
250−A queue.
251−
252−Source
253−------
254−
255− +- put :: insert new tail
256− |* b=*
257− |- ^+ a
258− ?~ a
259− [b ~ ~]
260− bal(+< a(l $(a l.a)))
261− ::
262−
263−Examples
264−--------
265−
266− ~zod/try=> (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~])
267− ~zod/try=> (~(put to a) 7)
268− {7 6 5 4 2 1 3}
269−
270−------------------------------------------------------------------------
271−
272−### `+-tap:to`
273−
274−Queue to list
275−
276−Produces [`++queue`]() `a` as a [`++list`]() from front to back.
277−
278−Accepts
279−-------
280−
281−`a` is a [queue]().
282−
283−Source
284−------
285−
286− +- tap :: queue to list
287− |= b=(list ,_?>(?=(^ a) n.a))
288− ^+ b
289− ?~ a
290− b
291− $(a r.a, b [n.a $(a l.a)])
292− ::
293−
294−Examples
295−--------
296−
297− ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[3 1 2 4 5 6 ~])
298− ~zod/try=> `*`a
299− [6 0 2 [4 [5 0 0] 0] 1 0 3 0 0]
300− ~zod/try=> (~(tap to a) `(list ,@)`[99 100 101 ~])
301− ~[3 1 2 4 5 6 99 100 101]
302−
303−------------------------------------------------------------------------
304−
305−### `+-top:to`
306−
307−Produces the head of [`++queue`]() `a` as a [`++unit`]() (an empty queue has no head).
308−
309−Accepts
310−-------
311−
312−`a` is a [queue]().
313−
314−Produces
315−--------
316−
317−A unit.
318−
319−Source
320−------
321−
322− +- top :: produces head
323− |- ^- (unit ,_?>(?=(^ a) n.a))
324− ?~ a ~
325− ?~(r.a [~ n.a] $(a r.a))
326−
327−Examples
328−--------
329−
330− ~zod/try=> =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 4 5 6 ~])
331− ~zod/try=> ~(top to a)
332− [~ 1]
333−
334------------------------------------------------------------------------
4------------------------------------------------------------------------
docs/system/hoon/library/2dd.md−35
@@ -36,41 +36,6 @@ Examples
36
36
37------------------------------------------------------------------------
37------------------------------------------------------------------------
38
38
39−### `++sa`
40−
41−Set from list
42−
43−Produces a set of the elements in list `a`.
44−
45−Accepts
46−-------
47−
48−`a` is a [list]().
49−
50−Produces
51−--------
52−
53−A [`++set`]().
54−
55−Source
56−------
57−
58− ++ sa :: set from list
59− |* a=(list)
60− => .(a `_(homo a)`a)
61− =+ b=*(set ,_?>(?=(^ a) i.a))
62− (~(gas in b) a)
63− ::
64−
65−
66−Examples
67−--------
68−
69− ~zod/try=> (sa `(list ,@)`[1 2 3 4 5 ~])
70− {5 4 1 3 2}
71− ~zod/try=> (sa `(list ,[@t *])`[[`a` 1] [`b` 2] ~])
72− {[`a` 1] [`b` 2]}
73−
74------------------------------------------------------------------------
39------------------------------------------------------------------------
75
40
76### `++qu`
41### `++qu`
docs/system/hoon/library/2ea.md−214
@@ -1,224 +1,10 @@
12eA packing
12eA packing
2===========
2===========
3
3
4−### `++cue`
5−
6−Unpack atom to noun
7−
8−Produces a noun unpacked from atom `a`. The inverse of jam.
9−
10−Accepts
11−-------
12−
13−`a` is an [atom]().
14−
15−Produces
16−--------
17−
18−A [`++noun`]().
19−
20−Source
21−------
22−
23− ++ cue :: unpack atom to noun
24− ~/ %cue
25− |= a=@
26− ^- *
27− =+ b=0
28− =+ m=`(map ,@ ,*)`~
29− =< q
30− |- ^- [p=@ q=* r=_m]
31− ?: =(0 (cut 0 [b 1] a))
32− =+ c=(rub +(b) a)
33− [+(p.c) q.c (~(put by m) b q.c)]
34− =+ c=(add 2 b)
35− ?: =(0 (cut 0 [+(b) 1] a))
36− =+ u=$(b c)
37− =+ v=$(b (add p.u c), m r.u)
38− =+ w=[q.u q.v]
39− [(add 2 (add p.u p.v)) w (~(put by r.v) b w)]
40− =+ d=(rub c a)
41− [(add 2 p.d) (need (~(get by m) q.d)) m]
42− ::
43−
44−
45−Examples
46−--------
47−
48− ~zod/try=> (cue 12)
49− 1
50− ~zod/try=> (cue 817)
51− [1 1]
52− ~zod/try=> (cue 4.657)
53− [1 2]
54− ~zod/try=> (cue 39.689)
55− [0 19]
56−
57------------------------------------------------------------------------
4------------------------------------------------------------------------
58
5
59−### `++jam`
60−
61−Unpack noun to atom
62−
63−Produces an atom unpacked from noun `a`. The inverse of cue.
64−
65−Accepts
66−-------
67−
68−`a` is a [noun]().
69−
70−Produces
71−--------
72−
73−An atom.
74−
75−Source
76−------
77−
78− ++ jam :: pack
79− ~/ %jam
80− |= a=*
81− ^- @
82− =+ b=0
83− =+ m=`(map ,* ,@)`~
84− =< q
85− |- ^- [p=@ q=@ r=_m]
86− =+ c=(~(get by m) a)
87− ?~ c
88− => .(m (~(put by m) a b))
89− ?: ?=(@ a)
90− =+ d=(mat a)
91− [(add 1 p.d) (lsh 0 1 q.d) m]
92− => .(b (add 2 b))
93− =+ d=$(a -.a)
94− =+ e=$(a +.a, b (add b p.d), m r.d)
95− [(add 2 (add p.d p.e)) (mix 1 (lsh 0 2 (cat 0 q.d q.e))) r.e]
96− ?: ?&(?=(@ a) (lte (met 0 a) (met 0 u.c)))
97− =+ d=(mat a)
98− [(add 1 p.d) (lsh 0 1 q.d) m]
99− =+ d=(mat u.c)
100− [(add 2 p.d) (mix 3 (lsh 0 2 q.d)) m]
101− ::
102−
103−
104−Examples
105−--------
106−
107− ~zod/try=> (jam 1)
108− 12
109− ~zod/try=> (jam [1 1])
110− 817
111− ~zod/try=> (jam [1 2])
112− 4.657
113− ~zod/try=> (jam [~ u=19])
114− 39.689
115−
116------------------------------------------------------------------------
6------------------------------------------------------------------------
117
7
118−### `++mat`
119−
120−Length-encode
121−
122−Produces a cell whose tail `q` is atom `a` with a bit representation of
123−its length prepended to it (as the least significant bits). The head `p`
124−is the length of `q` in bits.
125−
126−Accepts
127−-------
128−
129−`a` is an atom.
130−
131−Produces
132−--------
133−
134−A cell of two atoms, `p` and `q`.
135−
136−Source
137−------
138−
139− ++ mat :: length-encode
140− ~/ %mat
141− |= a=@
142− ^- [p=@ q=@]
143− ?: =(0 a)
144− [1 1]
145− =+ b=(met 0 a)
146− =+ c=(met 0 b)
147− :- (add (add c c) b)
148− (cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a)))
149−
150−
151−Examples
152−--------
153−
154− ~zod/try=> (mat 0xaaa)
155− [p=20 q=699.024]
156− ~zod/try=> (met 0 q:(mat 0xaaa))
157− 20
158− ~zod/try=> `@ub`q:(mat 0xaaa)
159− 0b1010.1010.1010.1001.0000
160− ~zod/try=> =a =-(~&(- -) `@ub`0xaaa)
161− 0b1010.1010.1010
162− ~zod/try=> =b =-(~&(- -) `@ub`(xeb a))
163− 0b1100
164− ~zod/try=> =b =-(~&(- -) `@ub`(met 0 a))
165− 0b1100
166− ~zod/try=> =c =-(~&(- -) (xeb b))
167− 4
168− ~zod/try=> [`@ub`a `@ub`(end 0 (dec c) b) `@ub`(bex c)]
169− [0b1010.1010.1010 0b100 0b1.0000]
170−
171------------------------------------------------------------------------
8------------------------------------------------------------------------
172
9
173−### `++rub`
174−
175−Length-decode
176−
177−The inverse of `++mat`. Accepts a cell of index `a` and a bitstring `b`
178−and produces the cell whose tail `q` is the decoded atom at index `a`
179−and whose head is the length of the encoded atom `q`, by which the
180−offset `a` is advanced. Only used internally as a helper cue.
181−
182−Accepts
183−-------
184−
185−`a` is an atom.
186−
187−`b` is a bitstring as an atom.
188−
189−Produces
190−--------
191−
192−A cell of two atoms, `p` and `q`.
193−
194−Source
195−------
196−
197− ++ rub :: length-decode
198− ~/ %rub
199− |= [a=@ b=@]
200− ^- [p=@ q=@]
201− =+ ^= c
202− =+ [c=0 m=(met 0 b)]
203− |- ?< (gth c m)
204− ?. =(0 (cut 0 [(add a c) 1] b))
205− c
206− $(c +(c))
207− ?: =(0 c)
208− [1 0]
209− =+ d=(add a +(c))
210− =+ e=(add (bex (dec c)) (cut 0 [d (dec c)] b))
211− [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)]
212−
213−
214−Examples
215−--------
216−
217− ~zod/try=> `@ub`(jam 0xaaa)
218− 0b1.0101.0101.0101.0010.0000
219− ~zod/try=> (rub 1 0b1.0101.0101.0101.0010.0000)
220− [p=20 q=2.730]
221− ~zod/try=> `@ux`q:(rub 1 0b1.0101.0101.0101.0010.0000)
222− 0xaaa
223−
224------------------------------------------------------------------------
10------------------------------------------------------------------------
docs/system/hoon/library/2eb.md−87
@@ -1,93 +1,6 @@
12eB parsing (tracing)
12eB parsing (tracing)
2=====================
2=====================
3
3
4−### `++last`
5−
6−Farther trace
7−
8−Compares two line-column pairs, called [`++hair`]()s, `zyc` and `naz`, producing whichever
9−is further along.
10−
11−Accepts
12−-------
13−
14−`naz` is a [hair]().
15−
16−`zyc` is a [hair]().
17−
18−Produces
19−--------
20−
21−a `++hair`.
22−
23−Source
24−------
25−
26− ++ last |= [zyc=hair naz=hair] :: farther trace
27− ^- hair
28− ?: =(p.zyc p.naz)
29− ?:((gth q.zyc q.naz) zyc naz)
30− ?:((gth p.zyc p.naz) zyc naz)
31− ::
32−
33−
34−Examples
35−--------
36−
37− ~zod/try=> (last [1 1] [1 2])
38− [p=1 q=2]
39− ~zod/try=> (last [2 1] [1 2])
40− [p=2 q=1]
41− ~zod/try=> (last [0 0] [99 0])
42− [p=99 q=0]
43− ~zod/try=> (last [7 7] [7 7])
44− [p=7 q=7]
45−
46------------------------------------------------------------------------
4------------------------------------------------------------------------
47
5
48−### `++lust`
49−
50−Detect newline
51−
52−Advances the [`++hair`]() `naz` by a row if the [`++char`]() `weq` is a newline, or by a
53−column if `weq` is any other character.
54−
55−Accepts
56−-------
57−
58−`weq` is a char.
59−
60−`naz` is a hair.
61−
62−Produces
63−--------
64−
65−A hair.
66−
67−Source
68−------
69−
70− ++ lust |= [weq=char naz=hair] :: detect newline
71− ^- hair
72− ?:(=(10 weq) [+(p.naz) 1] [p.naz +(q.naz)])
73−
74−
75−Examples
76−--------
77−
78− ~zod/try=> (lust `a` [1 1])
79− [p=1 q=2]
80− ~zod/try=> (lust `@t`10 [1 1])
81− [p=2 q=1]
82− ~zod/try=> (lust '9' [10 10])
83− [p=10 q=11]
84− /~zod/try=> (roll "maze" [.(+<+ [1 1])]:lust)
85− [1 5]
86− /~zod/try=> %- roll :_ [.(+<+ [1 1])]:lust
87− """
88− Sam
89− lokes
90− """
91− [2 6]
92−
93------------------------------------------------------------------------
6------------------------------------------------------------------------
docs/system/hoon/library/2ec.md−830
@@ -1,872 +1,42 @@
12eC parsing (custom rules)
12eC parsing (custom rules)
2==========================
2==========================
3
3
4−### `++cold`
5−
6−Replace with constant
7−
8−Parser modifier. Accepts a [`++rule`]() `sef` and produces a parser that
9−produces a constant `cus`, assuming `sef` is successful.
10−
11−Accepts
12−-------
13−
14−`cus` is a constant [noun]().
15−
16−`sef` is a `++rule`.
17−
18−Produces
19−--------
20−
21−An [`++edge`]().
22−
23−Source
24−------
25−
26− ++ cold :: replace w/ constant
27− ~/ %cold
28− |* [cus=* sef=_rule]
29− ~/ %fun
30− |= tub=nail
31− =+ vex=(sef tub)
32− ?~ q.vex
33− vex
34− [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]]
35− ::
36−
37−Examples
38−--------
39−
40− ~zod/try=> ((cold %foo (just 'a')) [[1 1] "abc"])
41− [p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]]
42− ~zod/try=> ((cold %foo (just 'a')) [[1 1] "bc"])
43− [p=[p=1 q=1] q=~]
44−
45------------------------------------------------------------------------
4------------------------------------------------------------------------
46
5
47−### `++cook`
48−
49−Apply gate
50−
51−Parser modifier. Produces a parser that takes a (successful) result of a
52−[`++rule`]() `sef` and slams it through `poq`.
53−
54−Accepts
55−-------
56−
57−`poq` is a [gate]().
58−
59−`sef` is a [`++rule`]().
60−
61−Produces
62−--------
63−
64−An [`++rule`]().
65−
66−Source
67−------
68−
69− ++ cook :: apply gate
70− ~/ %cook
71− |* [poq=_,* sef=_rule]
72− ~/ %fun
73− |= tub=nail
74− =+ vex=(sef tub)
75− ?~ q.vex
76− vex
77− [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]]
78− ::
79−
80−Examples
81−--------
82−
83− ~zod/try=> ((cook ,@ud (just 'a')) [[1 1] "abc"])
84− [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
85− ~zod/try=> ((cook ,@tas (just 'a')) [[1 1] "abc"])
86− [p=[p=1 q=2] q=[~ u=[p=%a q=[p=[p=1 q=2] q="bc"]]]]
87− ~zod/try=> ((cook |=(a=@ +(a)) (just 'a')) [[1 1] "abc"])
88− [p=[p=1 q=2] q=[~ u=[p=98 q=[p=[p=1 q=2] q="bc"]]]]
89− ~zod/try=> ((cook |=(a=@ `@t`+(a)) (just 'a')) [[1 1] "abc"])
90− [p=[p=1 q=2] q=[~ u=[p='b' q=[p=[p=1 q=2] q="bc"]]]]
91−
92------------------------------------------------------------------------
6------------------------------------------------------------------------
93
7
94−### `++easy`
95−
96−Always parse
97−
98−Parser generator. Produces a parser that succeeds with given [noun]() `huf`
99−without consuming any text.
100−
101−Accepts
102−-------
103−
104−`huf` is a noun.
105−
106−Produces
107−--------
108−
109−A [`++rule`]().
110−
111−Source
112−------
113−
114− ++ easy :: always parse
115− ~/ %easy
116− |* huf=*
117− ~/ %fun
118− |= tub=nail
119− ^- (like ,_huf)
120− [p=p.tub q=[~ u=[p=huf q=tub]]]
121− ::
122−
123−Examples
124−--------
125−
126− ~zod/try=> ((easy %foo) [[1 1] "abc"])
127− [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]]
128− ~zod/try=> ((easy %foo) [[1 1] "bc"])
129− [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="bc"]]]]
130− ~zod/try=> ((easy 'a') [[1 1] "bc"])
131− [p=[p=1 q=1] q=[~ [p='a' q=[p=[p=1 q=1] q="bc"]]]]
132−
133------------------------------------------------------------------------
8------------------------------------------------------------------------
134
9
135−### `++fail`
136−
137−Never parse
138−
139−Produces an [`++edge`]() at the same text position ([`++hair`]()) with a failing
140−result (`q=~`).
141−
142−Accepts
143−-------
144−
145−`tub` is a [`++nail`]().
146−
147−Produces
148−--------
149−
150−An `++edge`.
151−
152−Source
153−------
154−
155− ++ fail |=(tub=nail [p=p.tub q=~]) :: never parse
156−
157−Examples
158−--------
159−
160− ~zod/try=> (fail [[1 1] "abc"])
161− [p=[p=1 q=1] q=~]
162− ~zod/try=> (fail [[p=1.337 q=70] "Parse me, please?"])
163− [p=[p=1.337 q=70] q=~]
164−
165------------------------------------------------------------------------
10------------------------------------------------------------------------
166
11
167−### `++full`
168−
169−Parse to end
170−
171−Parser modifier. Accepts a [`++rule`]() `sef`, and produces a parser that succeeds only
172−when the of `tub` is fully consumed using `sef`.
173−
174−Accepts
175−-------
176−
177−`sef` is a [`++rule`]().
178−
179−Produces
180−--------
181−
182−A `++rule`.
183−
184−Source
185−------
186−
187− ++ full :: parse to end
188− |* sef=_rule
189− |= tub=nail
190− =+ vex=(sef tub)
191− ?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~]))
192− ::
193−
194−Examples
195−--------
196−
197− ~zod/try=> ((full (just 'a')) [[1 1] "ab"])
198− [p=[p=1 q=2] q=~]
199− ~zod/try=> ((full (jest 'ab')) [[1 1] "ab"])
200− [p=[p=1 q=3] q=[~ u=[p='ab' q=[p=[p=1 q=3] q=""]]]]
201− ~zod/try=> ((full ;~(plug (just 'a') (just 'b'))) [[1 1] "ab"])
202− [p=[p=1 q=3] q=[~ u=[p=[~~a ~~b] q=[p=[p=1 q=3] q=""]]]]
203−
204------------------------------------------------------------------------
12------------------------------------------------------------------------
205
13
206−### `++funk`
207−
208−Add to tape
209−
210−Parser modifier: prepend text to [`++tape`]() before applying parser.
211−
212−Accepts
213−-------
214−
215−`pre` is a `++tape`
216−
217−`sef` is a [`++rule`]()
218−
219−Produces
220−--------
221−
222−A `++rule`.
223−
224−Source
225−------
226−
227− ++ funk :: add to tape first
228− |* [pre=tape sef=_rule]
229− |= tub=nail
230− (sef p.tub (weld pre q.tub))
231− ::
232−
233−Examples
234−--------
235−
236− ~zod/try=> ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"])
237− [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]]
238− ~zod/try=> ((funk "parse" (just 'a')) [[1 4] " me"])
239− [p=[p=1 q=4] q=~]
240−
241------------------------------------------------------------------------
14------------------------------------------------------------------------
242
15
243−### `++here`
244−
245−Place-based apply
246−
247−Parser modifier. Similar to [`++cook`]() in that it produces a parser that takes a
248−(successful) result of `sef` and slams it through `hez`. `hez` accepts a
249−[`++pint`]() `a` and a [noun]() `b`, which is what the parser parsed.
250−
251−Accepts
252−-------
253−
254−`hez` is a [gate]().
255−
256−`sef` is a [`++rule`]()
257−
258−Produces
259−--------
260−
261−A `++rule`.
262−
263−Source
264−------
265−
266− ++ here :: place-based apply
267− ~/ %here
268− |* [hez=_|=([a=pint b=*] [a b]) sef=_rule]
269− ~/ %fun
270− |= tub=nail
271− =+ vex=(sef tub)
272− ?~ q.vex
273− vex
274− [p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]]
275− ::
276−
277−Examples
278−--------
279−
280− ~zod/try=> (scan "abc" (star alf))
281− "abc"
282− ~zod/try=> (scan "abc" (here |*(^ +<) (star alf)))
283− [[[p=1 q=1] p=1 q=4] "abc"]
284− ~zod/try=> (scan "abc" (star (here |*(^ +<) alf)))
285− ~[[[[p=1 q=1] p=1 q=2] ~~a] [[[p=1 q=2] p=1 q=3] ~~b] [[[p=1 q=3] p=1 q=4] ~~c]]
286−
287------------------------------------------------------------------------
16------------------------------------------------------------------------
288
17
289−### `++inde`
290−
291−Indentation block
292−
293−Apply [`++rule`]() to indented block starting at current column number, omitting
294−the leading whitespace.
295−
296−Accepts
297−-------
298−
299−`sef` is a [`++rule`]()
300−
301−Produces
302−--------
303−
304−A `++rule`.
305−
306−Source
307−------
308−
309− ++ inde |* sef=_rule :: indentation block
310− |= nail ^+ (sef)
311− =+ [har tap]=[p q]:+<
312− =+ lev=(fil 3 (dec q.har) ' ')
313− =+ eol=(just `@t`10)
314− =+ =- roq=((star ;~(pose prn ;~(sfix eol (jest lev)) -)) har tap)
315− ;~(simu ;~(plug eol eol) eol)
316− ?~ q.roq roq
317− =+ vex=(sef har(q 1) p.u.q.roq)
318− =+ fur=p.vex(q (add (dec q.har) q.p.vex))
319− ?~ q.vex vex(p fur)
320− =- vex(p fur, u.q -)
321− :+ &3.vex
322− &4.vex(q.p (add (dec q.har) q.p.&4.vex))
323− =+ res=|4.vex
324− |- ?~ res |4.roq
325− ?. =(10 -.res) [-.res $(res +.res)]
326− (welp [`@t`10 (trip lev)] $(res +.res))
327− ::
328−
329−Examples
330−--------
331−
332− ~zod/try=> (scan "abc" (inde (star ;~(pose prn (just `@`10)))))
333− "abc"
334− ~zod/try=> (scan "abc" (star ;~(pose prn (just `@`10))))
335− "abc"
336− ~zod/try=> (scan " abc\0ade" ;~(pfix ace ace (star ;~(pose prn (just `@`10)))))
337− "abc
338− de"
339− ~zod/try=> (scan " abc\0ade" ;~(pfix ace ace (inde (star ;~(pose prn (just `@`10))))))
340− ! {1 6}
341− ! exit
342− ~zod/try=> (scan " abc\0a de" ;~(pfix ace ace (inde (star ;~(pose prn (just `@`10))))))
343− "abc
344− de"
345−
346------------------------------------------------------------------------
18------------------------------------------------------------------------
347
19
348−### `++jest`
349−
350−Match a cord
351−
352−Match and consume a cord.
353−
354−Accepts
355−-------
356−
357−`daf` is a [`@t`]().
358−
359−Produces
360−--------
361−
362−An [`++edge`]().
363−
364−Source
365−------
366−
367− ++ jest :: match a cord
368− |= daf=@t
369− |= tub=nail
370− =+ fad=daf
371− |- ^- (like ,@t)
372− ?: =(0 daf)
373− [p=p.tub q=[~ u=[p=fad q=tub]]]
374− ?: |(?=(~ q.tub) !=((end 3 1 daf) i.q.tub))
375− (fail tub)
376− $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 1 daf))
377− ::
378−
379−Examples
380−--------
381−
382− ~zod/try=> ((jest 'abc') [[1 1] "abc"])
383− [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]]
384− ~zod/try=> (scan "abc" (jest 'abc'))
385− 'abc'
386− ~zod/try=> (scan "abc" (jest 'acb'))
387− ! {1 2}
388− ! 'syntax-error'
389− ! exit
390− ~zod/try=> ((jest 'john doe') [[1 1] "john smith"])
391− [p=[p=1 q=6] q=~]
392− ~zod/try=> ((jest 'john doe') [[1 1] "john doe"])
393− [p=[p=1 q=9] q=[~ [p='john doe' q=[p=[p=1 q=9] q=""]]]]
394−
395------------------------------------------------------------------------
20------------------------------------------------------------------------
396
21
397−### `++just`
398−
399−Match a char
400−
401−Match and consume a single character.
402−
403−Accepts
404−-------
405−
406−`daf` is a [`++char`]()
407−
408−Produces
409−--------
410−
411−A [`++rule`]().
412−
413−Source
414−------
415−
416− ++ just :: XX redundant, jest
417− ~/ %just :: match a char
418− |= daf=char
419− ~/ %fun
420− |= tub=nail
421− ^- (like char)
422− ?~ q.tub
423− (fail tub)
424− ?. =(daf i.q.tub)
425− (fail tub)
426− (next tub)
427− ::
428−
429−
430−Examples
431−--------
432−
433− ~zod/try=> ((just 'a') [[1 1] "abc"])
434− [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
435− ~zod/try=> (scan "abc" (just 'a'))
436− ! {1 2}
437− ! 'syntax-error'
438− ! exit
439− ~zod/try=> (scan "a" (just 'a'))
440− ~~a
441− ~zod/try=> (scan "%" (just '%'))
442− ~~~25.
443−
444------------------------------------------------------------------------
22------------------------------------------------------------------------
445
23
446−### `++knee`
447−
448−Recursive parsers
449−
450−Used for recursive parsers, which would otherwise be infinite when
451−compiled.
452−
453−Accepts
454−-------
455−
456−`gar` is a noun.
457−
458−`sef` is a [gate]() that accepts a [`++rule`]()
459−
460−Produces
461−--------
462−
463−A [`++rule`]().
464−
465−Source
466−------
467−
468− ++ knee :: callbacks
469− |* [gar=* sef=_|.(rule)]
470− |= tub=nail
471− ^- (like ,_gar)
472− ((sef) tub)
473− ::
474−
475−Examples
476−--------
477−
478− ~zod/try=> |-(;~(plug prn ;~(pose $ (easy ~))))
479− ! rest-loop
480− ! exit
481− ~zod/try=> |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~))))
482− < 1.obo
483− [ c=c=tub=[p=[p=@ud q=@ud] q=""]
484− b
485− < 1.bes
486− [ c=tub=[p=[p=@ud q=@ud] q=""]
487− b=<1.tnv [tub=[p=[p=@ud q=@ud] q=""] <1.ktu [daf=@tD <414.fvk 101.jzo 1.ypj %164>]>]>
488− a=<1.fvg [tub=[p=[p=@ud q=@ud] q=""] <1.khu [[les=@ mos=@] <414.fvk 101.jzo 1.ypj %164>]>]>
489− v=<414.fvk 101.jzo 1.ypj %164>
490− ]
491− >
492− a
493− ... 450 lines omitted ...
494− ]
495− >
496− ~zod/try=> (scan "abcd" |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~)))))
497− [~~a "bcd"]
498−
499------------------------------------------------------------------------
24------------------------------------------------------------------------
500
25
501−### `++mask`
502−
503−Match char
504−
505−Parser generator. Matches the next character if it is in a list of
506−characters.
507−
508−Accepts
509−-------
510−
511−`bud` is a list of [`++char`]()
512−
513−Produces
514−--------
515−
516−A [`++rule`]().
517−
518−Source
519−------
520−
521− ++ mask :: match char in set
522− ~/ %mask
523− |= bud=(list char)
524− ~/ %fun
525− |= tub=nail
526− ^- (like char)
527− ?~ q.tub
528− (fail tub)
529− ?. (lien bud |=(a=char =(i.q.tub a)))
530− (fail tub)
531− (next tub)
532− ::
533−
534−Examples
535−--------
536−
537− ~zod/try=> (scan "a" (mask "cba"))
538− ~~a
539− ~zod/try=> ((mask "abc") [[1 1] "abc"])
540− [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
541− ~zod/try=> ((mask "abc") [[1 1] "bbc"])
542− [p=[p=1 q=2] q=[~ [p=~~b q=[p=[p=1 q=2] q="bc"]]]]
543− ~zod/try=> ((mask "abc") [[1 1] "dbc"])
544− [p=[p=1 q=1] q=~]
545−
546------------------------------------------------------------------------
26------------------------------------------------------------------------
547
27
548−### `++next`
549−
550−Consume char
551−
552−Consume any character, producing it as a result.
553−
554−Accepts
555−-------
556−
557−`tub` is a [`++nail`]()
558−
559−Produces
560−--------
561−
562−An [`++edge`]().
563−
564−Source
565−------
566−
567− ++ next :: consume a char
568− |= tub=nail
569− ^- (like char)
570− ?~ q.tub
571− (fail tub)
572− =+ zac=(lust i.q.tub p.tub)
573− [zac [~ i.q.tub [zac t.q.tub]]]
574− ::
575−
576−Examples
577−--------
578−
579− ~zod/try=> (next [[1 1] "ebc"])
580− [p=[p=1 q=2] q=[~ [p=~~e q=[p=[p=1 q=2] q="bc"]]]]
581− ~zod/try=> (next [[1 1] "john jumps jones"])
582− [p=[p=1 q=2] q=[~ [p=~~j q=[p=[p=1 q=2] q="ohn jumps jones"]]]]
583−
584------------------------------------------------------------------------
28------------------------------------------------------------------------
585
29
586−### `++sear`
587−
588−Conditional `++cook`
589−
590−Conditional [`++cook`](). Slams the result through a gate that produces
591−a unit; if that unit is empty, fail.
592−
593−Accepts
594−-------
595−
596−`tub` is a [`++nail`](/doc/hoon/library/1#++nail)
597−
598−Produces
599−--------
600−
601−A [`++rule`]().
602−
603−Source
604−------
605−
606− ++ sear :: conditional cook
607− |* [pyq=_|=(* *(unit)) sef=_rule]
608− |= tub=nail
609− =+ vex=(sef tub)
610− ?~ q.vex
611− vex
612− =+ gey=(pyq p.u.q.vex)
613− ?~ gey
614− [p=p.vex q=~]
615− [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]]
616− ::
617−
618−Examples
619−--------
620−
621− ~zod/try=> ((sear |=(a=* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"])
622− [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
623− ~zod/try=> ((sear |=(* ~) (just 'a')) [[1 1] "abc"])
624− [p=[p=1 q=2] q=~]
625−
626------------------------------------------------------------------------
30------------------------------------------------------------------------
627
31
628−### `++shim`
629−
630−Char in range
631−
632−Match characters ([`++char`]()) within a range.
633−
634−Accepts
635−-------
636−
637−`les` is an atom.
638−
639−`mos` is an atom.
640−
641−Produces
642−--------
643−
644−A [`++rule`]().
645−
646−Source
647−------
648−
649− ++ shim :: match char in range
650− ~/ %shim
651− |= [les=@ mos=@]
652− ~/ %fun
653− |= tub=nail
654− ^- (like char)
655− ?~ q.tub
656− (fail tub)
657− ?. ?&((gte i.q.tub les) (lte i.q.tub mos))
658− (fail tub)
659− (next tub)
660− ::
661−
662−Examples
663−--------
664−
665− ~zod/try=> ((shim 'a' 'z') [[1 1] "abc"])
666− [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
667− ~zod/try=> ((shim 'a' 'Z') [[1 1] "abc"])
668− [p=[p=1 q=1] q=~]
669− ~zod/try=> ((shim 'a' 'Z') [[1 1] "Abc"])
670− [p=[p=1 q=2] q=[~ [p=~~~41. q=[p=[p=1 q=2] q="bc"]]]]
671−
672------------------------------------------------------------------------
32------------------------------------------------------------------------
673
33
674−### `++stag`
675−
676−Add label
677−
678−Add a label to an edge parsed by a rule.
679−
680−Accepts
681−-------
682−
683−`gob` is a noun.
684−
685−`sef` is a rule.
686−
687−Produces
688−--------
689−
690−A [`++rule`]().
691−
692−Source
693−------
694−
695− ++ stag :: add a label
696− ~/ %stag
697− |* [gob=* sef=_rule]
698− ~/ %fun
699− |= tub=nail
700− =+ vex=(sef tub)
701− ?~ q.vex
702− vex
703− [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]]
704− ::
705−
706−Examples
707−--------
708−
709− ~zod/try=> ((stag %foo (just 'a')) [[1 1] "abc"])
710− [p=[p=1 q=2] q=[~ u=[p=[%foo ~~a] q=[p=[p=1 q=2] q="bc"]]]]
711− ~zod/try=> ((stag "xyz" (jest 'abc')) [[1 1] "abc"])
712− [p=[p=1 q=4] q=[~ u=[p=["xyz" 'abc'] q=[p=[p=1 q=4] q=""]]]]
713− ~zod/try=> ((stag 10.000 (shim 0 100)) [[1 1] "abc"])
714− [p=[p=1 q=2] q=[~ u=[p=[10.000 ~~a] q=[p=[p=1 q=2] q="bc"]]]]
715−
716------------------------------------------------------------------------
34------------------------------------------------------------------------
717
35
718−### `++stet`
719−
720−Add faces
721−
722−Add faces `[p q]` to range-parser pairs in a list.
723−
724−Accepts
725−-------
726−
727−`leh` is a list of range-parsers.
728−
729−Produces
730−--------
731−
732−
733−
734−Source
735−------
736−
737− ++ stet
738− |* leh=(list ,[?(@ [@ @]) _rule])
739− |-
740− ?~ leh
741− ~
742− [i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)]
743− ::
744−
745−Examples
746−--------
747−
748− ~zod/try=> (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)]
749− [[1 10] (cold %foo (just 'a'))]~]))
750− ~[
751− [p=5 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
752− [p=1 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
753− [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
754− [p=[1 10] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
755− ]
756− ~zod/try=> [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~]
757− [ [[1 1] <1.tnv [tub=[p=[p=@ud q=@ud] q=""] <1.ktu [daf=@tD <414.fvk 101.jzo 1.ypj %164>]>]>]
758− [[2 1] <1.fvg [tub=[p=[p=@ud q=@ud] q=""] <1.khu [[les=@ mos=@] <414.fvk 101.jzo 1.ypj %164>]>]>]
759− ~
760− ]
761− ~zod/try=> (stet (limo [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~]))
762− ~[
763− [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
764− [p=[2 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
765− ]
766−
767------------------------------------------------------------------------
36------------------------------------------------------------------------
768
37
769−### `++stew`
770−
771−Switch by first
772−
773− ++ stew :: switch by first char
774− ~/ %stew
775− |* leh=(list ,[p=?(@ [@ @]) q=_rule]) :: char/range keys
776− =+ ^= wor :: range complete lth
777− |= [ort=?(@ [@ @]) wan=?(@ [@ @])]
778− ?@ ort
779− ?@(wan (lth ort wan) (lth ort -.wan))
780− ?@(wan (lth +.ort wan) (lth +.ort -.wan))
781− =+ ^= hel :: build parser map
782− =+ hel=`(tree $_(?>(?=(^ leh) i.leh)))`~
783− |- ^+ hel
784− ?~ leh
785− ~
786− =+ yal=$(leh t.leh)
787− |- ^+ hel
788− ?~ yal
789− [i.leh ~ ~]
790− ?: (wor p.i.leh p.n.yal)
791− =+ nuc=$(yal l.yal)
792− ?> ?=(^ nuc)
793− ?: (vor p.n.yal p.n.nuc)
794− [n.yal nuc r.yal]
795− [n.nuc l.nuc [n.yal r.nuc r.yal]]
796− =+ nuc=$(yal r.yal)
797− ?> ?=(^ nuc)
798− ?: (vor p.n.yal p.n.nuc)
799− [n.yal l.yal nuc]
800− [n.nuc [n.yal l.yal l.nuc] r.nuc]
801− ~% %fun ..^$ ~
802− |= tub=nail
803− ?~ q.tub
804− (fail tub)
805− |-
806− ?~ hel
807− (fail tub)
808− ?: ?@ p.n.hel
809− =(p.n.hel i.q.tub)
810− ?&((gte i.q.tub -.p.n.hel) (lte i.q.tub +.p.n.hel))
811− :: (q.n.hel [(lust i.q.tub p.tub) t.q.tub])
812− (q.n.hel tub)
813− ?: (wor i.q.tub p.n.hel)
814− $(hel l.hel)
815− $(hel r.hel)
816− ::
817−
818−Parser generator. From an associative [`++list`]() of characters or character
819−ranges to [`++rule`]()s, construct a [`++map`](), and parse [`++tape`]()s only
820−with `++rules` associated with a range that the `++tape`'s first character falls in.
821−
822------------------------------------------------------------------------
38------------------------------------------------------------------------
823
39
824−### `++stir`
825−
826−Parse repeatedly
827−
828−Parse with [`++rule`]() as many times as possible, and fold over results with a
829−binary gate.
830−
831−Accepts
832−-------
833−
834−`rud` is a noun.
835−
836−`raq` is a gate that takes two nouns and produces a cell.
837−
838−`fel` is a rule.
839−
840−Produces
841−--------
842−
843−A rule.
844−
845−Source
846−------
847−
848−++ stir :: parse repeatedly
849− ~/ %stir
850− |* [rud=* raq=_|*([a=* b=*] [a b]) fel=_rule]
851− ~/ %fun
852− |= tub=nail
853− ^- (like ,_rud)
854− =+ vex=(fel tub)
855− ?~ q.vex
856− [p.vex [~ rud tub]]
857− =+ wag=$(tub q.u.q.vex)
858− ?> ?=(^ q.wag)
859− [(last p.vex p.wag) [~ (raq p.u.q.vex p.u.q.wag) q.u.q.wag]]
860− ::
861−
862−Examples
863−--------
864−
865− ~zod/try=> (scan "abc" (stir *@ add prn))
866− 294
867− ~zod/try=> (roll "abc" add)
868− b=294
869−
870------------------------------------------------------------------------
40------------------------------------------------------------------------
871
41
872### `++stun`
42### `++stun`
docs/system/hoon/library/2ed.md−395
@@ -1,415 +1,20 @@
12eD parsing (combinators)
12eD parsing (combinators)
2=========================
2=========================
3
3
4−### `++bend`
5−
6−Conditional composer
7−
8−Parsing composer: connects the [`++edge`]() `vex` with the subsequent [`++rule`]() `sab`
9−as an optional suffix, using [gate]() `raq` to compose or reject its
10−result. If there is no suffix, or if the suffix fails to be composed
11−with the current result, the current result is produced. Used to map a
12−group of rules to a specified output.
13−
14−Accepts
15−-------
16−
17−`raq` is a [gate]().
18−
19−`sab` is a [rule]().
20−
21−`vex` is an [edge]().
22−
23−Produces
24−--------
25−
26−A [`++rule`]().
27−
28−Source
29−------
30−
31− ++ bend :: conditional comp
32− ~/ %bend
33− |* raq=_|*([a=* b=*] [~ u=[a b]])
34− ~/ %fun
35− |* [vex=edge sab=_rule]
36− ?~ q.vex
37− vex
38− =+ yit=(sab q.u.q.vex)
39− =+ yur=(last p.vex p.yit)
40− ?~ q.yit
41− [p=yur q=q.vex]
42− =+ vux=(raq p.u.q.vex p.u.q.yit)
43− ?~ vux
44− [p=yur q=q.vex]
45− [p=yur q=[~ u=[p=u.vux q=q.u.q.yit]]]
46− ::
47−
48−Examples
49−--------
50−
51− ~zod/try=> (;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qs")
52− [p=[p=1 q=3] q=[~ u=[p=~~q q=[p=[p=1 q=2] q="s"]]]]
53− ~zod/try=> (;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qqq")
54− [p=[p=1 q=3] q=[~ u=[p=~~r q=[p=[p=1 q=3] q="q"]]]]
55− ~zod/try=> (scan "aa" ;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn))
56− ~~b
57− ~zod/try=> (scan "ba" ;~((bend |=([a=char b=char] ?.(=(a b) ~ (some +(a))))) prn prn))
58− ! {1 3}
59− ! exit
60− ~zod/try=> `(unit ,@tas)`(scan "" ;~((bend) (easy ~) sym))
61− ~
62− ~zod/try=> `(unit ,@tas)`(scan "sep" ;~((bend) (easy ~) sym))
63− [~ %sep]
64−
65------------------------------------------------------------------------
4------------------------------------------------------------------------
66
5
67−### `++comp`
68−
69−Arbitrary compose
70−
71−Parsing composer: connects the [`++edge`]() `vex` with a following [`++rule`]() `sab`,
72−combining the contents of `vex` with the result of `sab` using a binary
73−[gate]() `raq`. Used to fold over the results of several `++rules`.
74−
75−Accepts
76−-------
77−
78−`raq` is a gate that accepts a cell of two [nouns](), `a` and `b`, and
79−produces a cell of two nouns.
80−
81−`sab` is a rule.
82−
83−`vex` is an edge.
84−
85−Produces
86−--------
87−
88−A [`++rule`]().
89−
90−Source
91−------
92−
93− ++ comp
94− ~/ %comp
95− |* raq=_|*([a=* b=*] [a b]) :: arbitrary compose
96− ~/ %fun
97− |* [vex=edge sab=_rule]
98− ?~ q.vex
99− vex
100− =+ yit=(sab q.u.q.vex)
101− =+ yur=(last p.vex p.yit)
102− ?~ q.yit
103− [p=yur q=q.yit]
104− [p=yur q=[~ u=[p=(raq p.u.q.vex p.u.q.yit) q=q.u.q.yit]]]
105− ::
106−
107−Examples
108−--------
109−
110− ~zod/try=> (scan "123" ;~((comp |=([a=@u b=@u] (add a b))) dit dit dit))
111− 6
112− ~zod/try=> (scan "12" ;~((comp |=([a=@u b=@u] (add a b))) dit dit dit))
113− ! {1 3}
114− ! exit
115−
116------------------------------------------------------------------------
6------------------------------------------------------------------------
117
7
118−### `++glue`
119−
120−Skip delimiter
121−
122−Parsing composer: connects an [`++edge`]() `vex` with a following [`++rule`]() `sab` by
123−parsing the `++rule` `bus` (the delimiting symbol) and throwing out the
124−result.
125−
126−Accepts
127−-------
128−
129−`bus` is a `++rule`.
130−
131−`sab` is a `++rule`.
132−
133−`vex` is an `++edge`.
134−
135−Produces
136−--------
137−
138−
139−
140−Source
141−------
142−
143− ++ glue :: add rule
144− ~/ %glue
145− |* bus=_rule
146− ~/ %fun
147− |* [vex=edge sab=_rule]
148− (plug vex ;~(pfix bus sab))
149− ::
150−
151−Examples
152−--------
153−
154− ~zod/try=> (scan "200|mal|bon" ;~((glue bar) dem sym sym))
155− [q=200 7.102.829 7.237.474]
156− ~zod/try=> `[@u @tas @tas]`(scan "200|mal|bon" ;~((glue bar) dem sym sym))
157− [200 %mal %bon]
158− ~zod/try=> (scan "200|;|bon" ;~((glue bar) dem sem sym))
159− [q=200 ~~~3b. 7.237.474]
160− ~zod/try=> (scan "200.;.bon" ;~((glue dot) dem sem sym))
161− [q=200 ~~~3b. 7.237.474]
162−
163------------------------------------------------------------------------
8------------------------------------------------------------------------
164
9
165−### `++less`
166−
167−Parse unless
168−
169−Parsing composer: if an [`++edge`]() `vex` reflects a success, fail. Otherwise,
170−connect `vex` with the following [`++rule`]().
171−
172−Accepts
173−-------
174−
175−`sab` is a `++rule`.
176−
177−`vex` is an `++edge`.
178−
179−Produces
180−--------
181−
182−
183−
184−Source
185−------
186−
187− ++ less :: no first and second
188− |* [vex=edge sab=_rule]
189− ?~ q.vex
190− =+ roq=(sab)
191− [p=(last p.vex p.roq) q=q.roq]
192− vex(q ~)
193− ::
194−
195−Examples
196−--------
197−
198− ~zod/try=> (scan "sas-/lo" (star ;~(less lus bar prn)))
199− "sas-/lo"
200− ~zod/try=> (scan "sas-/l+o" (star ;~(less lus bar prn)))
201− ! {1 8}
202− ! exit
203− ~zod/try=> (scan "sas|-/lo" (star ;~(less lus bar prn)))
204− ! {1 5}
205− ! exit
206−
207------------------------------------------------------------------------
10------------------------------------------------------------------------
208
11
209−### `++pfix`
210−
211−Discard first rule
212−
213−Parsing composer: connects an [`++edge`]() `vex` with two subsequent [`++rule`]()s,
214−ignoring the result of the first and producing the result of the second.
215−
216−Accepts
217−-------
218−
219−`vex` is an [edge]().
220−
221−Produces
222−--------
223−
224−
225−
226−Source
227−------
228−
229− ++ pfix :: discard first rule
230− ~/ %pfix
231− (comp |*([a=* b=*] b))
232− ::
233−
234−Examples
235−--------
236−
237− ~zod/try=> `@t`(scan "%him" ;~(pfix cen sym))
238− 'him'
239− ~zod/try=> (scan "+++10" ;~(pfix (star lus) dem))
240− q=10
241−
242------------------------------------------------------------------------
12------------------------------------------------------------------------
243
13
244−### `++plug`
245−
246−Parse to tuple
247−
248−Parsing composer: connects an [`++edge`]() `vex` with a following [`++rule`]() `sab`, producing
249−a cell of both the results. See also: the monad applicator [;\~]() for a
250−more detailed explanation.
251−
252−Accepts
253−-------
254−
255−`sab` is a `++rule`.
256−
257−`vex` is an `++edge`.
258−
259−Produces
260−--------
261−
262−
263−
264−Source
265−------
266−
267− ++ plug :: first then second
268− ~/ %plug
269− |* [vex=edge sab=_rule]
270− ?~ q.vex
271− vex
272− =+ yit=(sab q.u.q.vex)
273− =+ yur=(last p.vex p.yit)
274− ?~ q.yit
275− [p=yur q=q.yit]
276− [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]]
277− ::
278−
279−Examples
280−--------
281−
282− ~zod/try=> (scan "1..20" ;~(plug dem dot dot dem))
283− [q=1 ~~~. ~~~. q=20]
284− ~zod/try=> (scan "moke/~2014.1.1" ;~(plug sym fas nuck:so))
285− [1.701.539.693 ~~~2f. [% p=[p=~.da q=170.141.184.500.766.106.671.844.917.172.921.958.400]]]
286− ~zod/try=> ;;(,[@tas @t ~ %da @da] (scan "moke/~2014.1.1" ;~(plug sym fas nuck:so)))
287− [%moke '/' ~ %da ~2014.1.1]
288−
289------------------------------------------------------------------------
14------------------------------------------------------------------------
290
15
291−### `++pose`
292−
293−Parse options
294−
295−Parsing composer: if `vex` reflects a failure, connect it with the
296−following rule `sab`. See also: the monad applicator [;\~]()
297−
298−Accepts
299−-------
300−
301−`sab` is a [`++rule`]().
302−
303−`vex` is an [`++edge`]().
304−
305−Produces
306−--------
307−
308−
309−
310−Source
311−------
312−
313− ++ pose :: first or second
314− ~/ %pose
315− |* [vex=edge sab=_rule]
316− ?~ q.vex
317− =+ roq=(sab)
318− [p=(last p.vex p.roq) q=q.roq]
319− vex
320−
321−Examples
322−--------
323−
324− ~zod/try=> `@t`(scan "+" ;~(pose lus tar cen))
325− '+'
326− ~zod/try=> `@t`(scan "*" ;~(pose lus tar cen))
327− '*'
328− ~zod/try=> `@t`(scan "%" ;~(pose lus tar cen))
329− '%'
330− ~zod/try=> `@t`(scan "-" ;~(pose lus tar cen))
331− ! {1 1}
332− ! exit
333−
334------------------------------------------------------------------------
16------------------------------------------------------------------------
335
17
336−### `++simu`
337−
338−First and second
339−
340−Parsing composer: if an [`++edge`]() `vex` reflects a failure, fail. Otherwise,
341−connect `vex` with the following [`++rule`]().
342−
343−Accepts
344−-------
345−
346−`sab` is a `++rule`.
347−
348−`vex` is an `++edge`.
349−
350−Produces
351−--------
352−
353−
354−
355−Source
356−------
357−
358− ++ simu :: first and second
359− |* [vex=edge sab=_rule]
360− ?~ q.vex
361− vex
362− =+ roq=(sab)
363− roq
364− ::
365−
366−Examples
367−--------
368−
369− ~zod/try=> (scan "~zod" scat:vast)
370− [%dtzy p=%p q=0]
371− ~zod/try=> (scan "%zod" scat:vast)
372− [%dtzz p=%tas q=6.582.138]
373− ~zod/try=> (scan "%zod" ;~(simu cen scat:vast))
374− [%dtzz p=%tas q=6.582.138]
375− ~zod/try=> (scan "~zod" ;~(simu cen scat:vast))
376− ! {1 1}
377− ! exit
378−
379------------------------------------------------------------------------
18------------------------------------------------------------------------
380
19
381−### `++sfix`
382−
383−Discard second rule
384−
385−Parsing composer: connects [`++edge`]()s `vex` with two subsequent [`++rule`]()s returning the
386−result of the first and discarding the result of the second.
387−
388−Accepts
389−-------
390−
391−`a` is the result of parsing the first `++rule`.
392−
393−`b` is the result of of parsing the second `++rule`.
394−
395−Produces
396−--------
397−
398−
399−
400−Source
401−------
402−
403− ++ sfix :: discard second rule
404− ~/ %sfix
405− (comp |*([a=* b=*] a))
406−
407−Examples
408−--------
409−
410− ~zod/try=> `@t`(scan "him%" ;~(sfix sym cen))
411− 'him'
412− ~zod/try=> (scan "10+++" ;~(sfix dem (star lus)))
413− q=10
414−
415------------------------------------------------------------------------
20------------------------------------------------------------------------
docs/system/hoon/library/2ee.md−286
@@ -1,305 +1,19 @@
12ee parsing (composers)
12ee parsing (composers)
2=======================
2=======================
3
3
4−### `++bass`
5−
6−Parser modifier: [LSB](http://en.wikipedia.org/wiki/Least_significant_bit)
7−ordered [`++list`]() as atom of a [`++base`]().
8−
9−Accepts
10−-------
11−
12−`wuc` is an atom.
13−
14−`tyd` is a [`++rule`]().
15−
16−Produces
17−--------
18−
19−A [`++rule`]().
20−
21−Source
22−------
23−
24− ++ bass
25− |* [wuc=@ tyd=_rule]
26− %+ cook
27− |= waq=(list ,@)
28− %+ roll
29− waq
30− =|([p=@ q=@] |.((add p (mul wuc q))))
31− tyd
32−
33−Examples
34−--------
35−
36− ~zod/try=> (scan "123" (bass 10 (star dit)))
37− q=123
38− ~zod/try=> (scan "123" (bass 8 (star dit)))
39− q=83
40− ~zod/try=> `@ub`(scan "123" (bass 8 (star dit)))
41− 0b101.0011
42−
43------------------------------------------------------------------------
4------------------------------------------------------------------------
44
5
45−### `++boss`
46−
47−Parser modifier: [LSB](http://en.wikipedia.org/wiki/Least_significant_bit)
48−ordered [`++list`]() as atom of a [`++base`]().
49−
50−Accepts
51−-------
52−
53−`wuc` is an atom.
54−
55−`tyd` is a [`++rule`]().
56−
57−Produces
58−--------
59−
60−A [`++rule`]().
61−
62−Source
63−------
64−
65− ++ boss
66− |* [wuc=@ tyd=_rule]
67− %+ cook
68− |= waq=(list ,@)
69− %+ reel
70− waq
71− =|([p=@ q=@] |.((add p (mul wuc q))))
72− tyd
73−
74−Examples
75−--------
76−
77− ~zod/try=> (scan "123" (boss 10 (star dit)))
78− q=321
79− ~zod/try=> `@t`(scan "bam" (boss 256 (star alp)))
80− 'bam'
81− ~zod/try=> `@ux`(scan "bam" (boss 256 (star alp)))
82− 0x6d.6162
83
6
84------------------------------------------------------------------------
7------------------------------------------------------------------------
85
8
86−### `++ifix`
87−
88−Surround
89−
90−Parser modifier: surround with pair of [`++rule`]()s, the output of which is
91−discarded.
92−
93−Accepts
94−-------
95−
96−`fel` is a pair of `++rule`s.
97−
98−`hof` is a `++rule`.
99−
100−Produces
101−--------
102−
103−A `++rule`.
104−
105−Source
106−------
107−
108− ++ ifix
109− |* [fel=[p=_rule q=_rule] hof=_rule]
110− ;~(pfix p.fel ;~(sfix hof q.fel))
111−
112−Examples
113−--------
114−
115− ~zod/try=> (scan "-40-" (ifix [hep hep] dem))
116− q=40
117− ~zod/try=> (scan "4my4" (ifix [dit dit] (star alf)))
118− "my"
119−
120------------------------------------------------------------------------
9------------------------------------------------------------------------
121
10
122−### `++more`
123−
124−Parse list with delimiter
125−
126−Parser modifier: Parse a list of matches using a delimiter [`++rule`]().
127−
128−Accepts
129−-------
130−
131−`bus` is a `++rule`.
132−
133−`fel` is a `++rule`.
134−
135−Produces
136−--------
137−
138−A `++rule`.
139−
140−Source
141−------
142−
143− ++ more
144− |* [bus=_rule fel=_rule]
145− ;~(pose (most bus fel) (easy ~))
146−
147−Examples
148−--------
149−
150− ~zod/try=> (scan "" (more ace dem))
151− ~
152− ~zod/try=> (scan "40 20" (more ace dem))
153− [q=40 ~[q=20]]
154− ~zod/try=> (scan "40 20 60 1 5" (more ace dem))
155− [q=40 ~[q=20 q=60 q=1 q=5]]
156−
157------------------------------------------------------------------------
11------------------------------------------------------------------------
158
12
159−### `++most`
160−
161−Parse list of at least one match
162−
163−Parser modifier: parse a [`++list`]() of at least one match using a delimiter [`++rule`]().
164−
165−Accepts
166−-------
167−
168−`bus` is a `++rule`.
169−
170−`fel` is a `++rule`.
171−
172−Produces
173−--------
174−
175−A `++rule`.
176−
177−Source
178−------
179−
180− ++ most
181− |* [bus=_rule fel=_rule]
182− ;~(plug fel (star ;~(pfix bus fel)))
183−
184−Examples
185−--------
186−
187− ~zod/try=> (scan "40 20" (most ace dem))
188− [q=40 ~[q=20]]
189− ~zod/try=> (scan "40 20 60 1 5" (most ace dem))
190− [q=40 ~[q=20 q=60 q=1 q=5]]
191− ~zod/try=> (scan "" (most ace dem))
192− ! {1 1}
193− ! exit
194−
195------------------------------------------------------------------------
13------------------------------------------------------------------------
196
14
197−### `++plus`
198−
199−List of at least one match.
200−
201−Parser modifier: parse [`++list`]() of at least one match.
202−
203−Accepts
204−-------
205−
206−`fel` is a [`++rule`]().
207−
208−Produces
209−--------
210−
211−A `++rule`.
212−
213−Source
214−------
215−
216− ++ plus |*(fel=_rule ;~(plug fel (star fel)))
217−
218−Examples
219−--------
220−
221− ~zod/try=> (scan ">>>>" (cook lent (plus gar)))
222− 4
223− ~zod/try=> (scan "- - " (plus ;~(pose ace hep)))
224− [~~- " - "]
225− ~zod/try=> `tape`(scan "- - " (plus ;~(pose ace hep)))
226− "- - "
227− ~zod/try=> `(pole ,@t)`(scan "- - " (plus ;~(pose ace hep)))
228− ['-' [' ' [' ' ['-' [' ' ~]]]]]
229−
230------------------------------------------------------------------------
15------------------------------------------------------------------------
231
16
232−### `++slug`
233−
234−Use gate to parse delimited list
235−
236−Parser modifier: By composing with a [gate](), parse a delimited [`++list`]() of
237−matches.
238−
239−Accepts
240−-------
241−
242−`bus` is a [`++rule`]().
243−
244−`fel` is a `++rule`.
245−
246−Produces
247−--------
248−
249−A `++rule`.
250−
251−Source
252−------
253−
254− ++ slug
255− |* raq=_|*([a=* b=*] [a b])
256− |* [bus=_rule fel=_rule]
257− ;~((comp raq) fel (stir +<+.raq raq ;~(pfix bus fel)))
258−
259−Examples
260−--------
261−
262− ~zod/try=> (scan "20+5+110" ((slug add) lus dem))
263− 135
264− ~zod/try=> `@t`(scan "a b c" ((slug |=(a=[@ @t] (cat 3 a))) ace alp))
265− 'abc'
266−
267------------------------------------------------------------------------
17------------------------------------------------------------------------
268
18
269−### `++star`
270−
271−List of matches
272−
273−Parser modifier: parse [`++list`]() of matches.
274−
275−Accepts
276−-------
277−
278−`fel` is a [`++rule`]().
279−
280−Produces
281−--------
282−
283− ++ star :: 0 or more times
284− |* fel=_rule
285− (stir `(list ,_(wonk *fel))`~ |*([a=* b=*] [a b]) fel)
286−
287−Examples
288−--------
289−
290− ~zod/try=> (scan "aaaaa" (just 'a'))
291− ! {1 2}
292− ! 'syntax-error'
293− ! exit
294− ~zod/try=> (scan "aaaaa" (star (just 'a')))
295− "aaaaa"
296− ~zod/try=> (scan "abcdef" (star (just 'a')))
297− ! {1 2}
298− ! 'syntax-error'
299− ! exit
300− ~zod/try=> (scan "abcabc" (star (jest 'abc')))
301− <|abc abc|>
302− ~zod/try=> (scan "john smith" (star (shim 0 200)))
303− "john smith"
304−
305------------------------------------------------------------------------
19------------------------------------------------------------------------
docs/system/hoon/library/2ef.md−774
@@ -1,843 +1,69 @@
12eF parsing (ascii)
12eF parsing (ascii)
2===================
2===================
3
3
4−### `++ace`
5−
6−Parse space
7−
8−Parses ASCII character 32, space.
9−
10−Source
11−------
12−
13− ++ ace (just ' ')
14−
15−Examples
16−--------
17−
18− ~zod/try=> (scan " " ace)
19− ~~.
20− ~zod/try=> `cord`(scan " " ace)
21− ' '
22− ~zod/try=> (ace [[1 1] " "])
23− [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q=""]]]]
24− ~zod/try=> (ace [[1 1] " abc "])
25− [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="abc "]]]]
26−
27------------------------------------------------------------------------
4------------------------------------------------------------------------
28
5
29−### `++bar`
30−
31−Parse vertical bar
32−
33−Parses ASCII character 124, the vertical bar.
34−
35−Source
36−------
37−
38− ++ bar (just '|')
39−
40−Examples
41−--------
42−
43− ~zod/try=> (scan "|" bar)
44− ~~~7c.
45− ~zod/try=> `cord`(scan "|" bar)
46− '|'
47− ~zod/try=> (bar [[1 1] "|"])
48− [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q=""]]]]
49− ~zod/try=> (bar [[1 1] "|="])
50− [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q="="]]]]
51−
52------------------------------------------------------------------------
6------------------------------------------------------------------------
53
7
54−### `++bas`
55−
56−Parse backslash
57−
58−Parses ASCII character 92, the backslash. Note the extra `\` in the calling of
59−`bas` with [`++just`](/doc/hoon/library/2ec#++just) is to escape the escape
60−character, `\`.
61−
62−Source
63−------
64−
65− ++ bas (just '\\')
66−
67−Examples
68−--------
69−
70− ~zod/try=> (scan "\\" bas)
71− ~~~5c.
72− ~zod/try=> `cord`(scan "\\" bas)
73− '\'
74− ~zod/try=> (bas [[1 1] "\"])
75− ~ <syntax error at [1 18]>
76− ~zod/try=> (bas [[1 1] "\\"])
77− [p=[p=1 q=2] q=[~ [p=~~~5c. q=[p=[p=1 q=2] q=""]]]]
78− ~zod/try=> (bas [[1 1] "\""])
79− [p=[p=1 q=1] q=~]
80−
81------------------------------------------------------------------------
8------------------------------------------------------------------------
82
9
83−### `++buc`
84−
85−Parse dollar sign
86−
87−Parses ASCII character 36, the dollar sign.
88−
89−Source
90−------
91−
92− ++ buc (just '$')
93−
94−Examples
95−--------
96−
97− ~zod/try=> (scan "$" buc)
98− ~~~24.
99− ~zod/try=> `cord`(scan "$" buc)
100− '$'
101− ~zod/try=> (buc [[1 1] "$"])
102− [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q=""]]]]
103− ~zod/try=> (buc [[1 1] "$%"])
104− [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q="%"]]]]
105−
106------------------------------------------------------------------------
10------------------------------------------------------------------------
107
11
108−### `++cab`
109−
110−Parse underscore
111−
112−Parses ASCII character 95, the underscore.
113−
114−Source
115−------
116−
117− ++ cab (just '_')
118−
119−Examples
120−--------
121−
122− ~zod/try=> (scan "_" cab)
123− ~~~5f.
124− ~zod/try=> `cord`(scan "_" cab)
125− '_'
126− ~zod/try=> (cab [[1 1] "_"])
127− [p=[p=1 q=2] q=[~ [p=~~~5f. q=[p=[p=1 q=2] q=""]]]]
128− ~zod/try=> (cab [[1 1] "|_"])
129− [p=[p=1 q=1] q=~]
130−
131------------------------------------------------------------------------
12------------------------------------------------------------------------
132
13
133−### `++cen`
134−
135−Parses percent sign
136−
137−Parses ASCII character 37, the percent sign.
138−
139−Source
140−------
141−
142− ++ cen (just '%')
143−
144−Examples
145−--------
146−
147− ~zod/try=> (scan "%" cen)
148− ~~~25.
149− ~zod/try=> `cord`(scan "%" cen)
150− '%'
151− ~zod/try=> (cen [[1 1] "%"])
152− [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q=""]]]]
153− ~zod/try=> (cen [[1 1] "%^"])
154− [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q="^"]]]]
155−
156------------------------------------------------------------------------
14------------------------------------------------------------------------
157
15
158−### `++col`
159−
160−Parse colon
161−
162−Parses ASCII character 58, the colon
163−
164−Source
165−------
166−
167− ++ col (just ':')
168−
169−Examples
170−--------
171−
172− ~zod/try=> (scan ":" col)
173− ~~~3a.
174− ~zod/try=> `cord`(scan ":" col)
175− ':'
176− ~zod/try=> (col [[1 1] ":"])
177− [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q=""]]]]
178− ~zod/try=> (col [[1 1] ":-"])
179− [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q="-"]]]]
180−
181------------------------------------------------------------------------
16------------------------------------------------------------------------
182
17
183−### `++com`
184−
185−Parse comma
186−
187−Parses ASCII character 44, the comma.
188−
189−Source
190−------
191−
192− ++ com (just ',')
193−
194−Examples
195−--------
196−
197− ~zod/try=> (scan "," com)
198− ~~~2c.
199− ~zod/try=> `cord`(scan "," com)
200− ','
201− ~zod/try=> (com [[1 1] ","])
202− [p=[p=1 q=2] q=[~ [p=~~~2c. q=[p=[p=1 q=2] q=""]]]]
203− ~zod/try=> (com [[1 1] "not com"])
204− [p=[p=1 q=1] q=~]
205−
206------------------------------------------------------------------------
18------------------------------------------------------------------------
207
19
208−### `++doq`
209−
210−Parse double quote
211−
212−Parses ASCII character 34, the double quote.
213−
214−Source
215−------
216−
217− ++ doq (just '"')
218−
219−Examples
220−--------
221−
222− ~zod/try=> (scan "\"" doq)
223− ~~~22.
224− ~zod/try=> `cord`(scan "\"" doq)
225− '"'
226− ~zod/try=> (doq [[1 1] "\""])
227− [p=[p=1 q=2] q=[~ [p=~~~22. q=[p=[p=1 q=2] q=""]]]]
228− ~zod/try=> (doq [[1 1] "not successfully parsed"])
229− [p=[p=1 q=1] q=~]
230− ~zod/try=> (scan "see?" doq)
231− ! {1 1}
232− ! 'syntax-error'
233− ! exit
234−
235------------------------------------------------------------------------
20------------------------------------------------------------------------
236
21
237−### `++dot`
238−
239−Parse period
240−
241−Parses ASCII character 46, the period.
242−
243−Source
244−------
245−
246− ++ dot (just '.')
247−
248−Examples
249−--------
250−
251− ~zod/try=> (scan "." dot)
252− ~~~.
253− ~zod/try=> `cord`(scan "." dot)
254− '.'
255− ~zod/try=> (dot [[1 1] "."])
256− [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q=""]]]]
257− ~zod/try=> (dot [[1 1] ".^"])
258− [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q="^"]]]]
259−
260------------------------------------------------------------------------
22------------------------------------------------------------------------
261
23
262−### `++fas`
263−
264−Parse forward slash
265−
266−Parses ASCII character 47, the forward slash.
267−
268−Source
269−------
270−
271− ++ fas (just '/')
272−
273−Examples
274−--------
275−
276− ~zod/try=> (scan "/" fas)
277− ~~~2f.
278− ~zod/try=> `cord`(scan "/" fas)
279− '/'
280− ~zod/try=> (fas [[1 1] "/"])
281− [p=[p=1 q=2] q=[~ [p=~~~2f. q=[p=[p=1 q=2] q=""]]]]
282− ~zod/try=> (fas [[1 1] "|/"])
283− [p=[p=1 q=1] q=~]
284−
285------------------------------------------------------------------------
24------------------------------------------------------------------------
286
25
287−### `++gal`
288−
289−Parse less-than sign
290−
291−Parses ASCII character 60, the less-than sign.
292−
293−Source
294−------
295−
296− ++ gal (just '<')
297−
298−Examples
299−--------
300−
301− ~zod/try=> (scan "<" gal)
302− ~~~3c.
303− ~zod/try=> `cord`(scan "<" gal)
304− '<'
305− ~zod/try=> (gal [[1 1] "<"])
306− [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q=""]]]]
307− ~zod/try=> (gal [[1 1] "<+"])
308− [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q="+"]]]]
309− ~zod/try=> (gal [[1 1] "+<"])
310− [p=[p=1 q=1] q=~]
311−
312------------------------------------------------------------------------
26------------------------------------------------------------------------
313
27
314−### `++gar`
315−
316−Parse greater-than sign
317−
318−Parses ASCII character 62, the greater-than sign.
319−
320−Source
321−------
322−
323− ++ gar (just '>')
324−
325−Examples
326−--------
327−
328− ~zod/try=> (scan ">" gar)
329− ~~~3e.
330− ~zod/try=> `cord`(scan ">" gar)
331− '>'
332− ~zod/try=> (gar [[1 1] ">"])
333− [p=[p=1 q=2] q=[~ [p=~~~3e. q=[p=[p=1 q=2] q=""]]]]
334− ~zod/try=> (gar [[1 1] "=>"])
335− [p=[p=1 q=1] q=~]
336−
337------------------------------------------------------------------------
28------------------------------------------------------------------------
338
29
339−### `++hax`
340−
341−Parse number sign
342−
343−Parses ASCII character 35, the number sign.
344−
345−Source
346−------
347−
348− ++ hax (just '#')
349−
350−Examples
351−--------
352−
353− ~zod/try=> (scan "#" hax)
354− ~~~23.
355− ~zod/try=> `cord`(scan "#" hax)
356− '#'
357− ~zod/try=> (hax [[1 1] "#"])
358− [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q=""]]]]
359− ~zod/try=> (hax [[1 1] "#!"])
360− [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q="!"]]]]
361−
362------------------------------------------------------------------------
30------------------------------------------------------------------------
363
31
364−### `++kel`
365−
366−Parse left curley bracket
367−
368−Parses ASCII character 123, the left curly bracket. Note that `{`
369−(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
370−interpolation. To parse either of them, they must be escaped.
371−
372−Source
373−------
374−
375− ++ kel (just '{')
376−
377−Examples
378−--------
379−
380− ~zod/try=> (scan "\{" kel)
381− ~~~7b.
382− ~zod/try=> `cord`(scan "\{" kel)
383− '{'
384− ~zod/try=> (kel [[1 1] "\{"])
385− [p=[p=1 q=2] q=[~ [p=~~~7b. q=[p=[p=1 q=2] q=""]]]]
386− ~zod/try=> (kel [[1 1] " \{"])
387− [p=[p=1 q=1] q=~]
388−
389------------------------------------------------------------------------
32------------------------------------------------------------------------
390
33
391−### `++ker`
392−
393−Parse right curley bracket
394−
395−Parses ASCII character 125, the right curly bracket. Note that `{`
396−(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
397−interpolation. To parse either of them, they must be escaped.
398−
399−Source
400−------
401−
402− ++ ker (just '}')
403−
404−Examples
405−--------
406−
407− ~zod/try=> (scan "}" ker)
408− ~~~7d.
409− ~zod/try=> `cord`(scan "}" ker)
410− '}'
411− ~zod/try=> (ker [[1 1] "}"])
412− [p=[p=1 q=2] q=[~ [p=~~~7d. q=[p=[p=1 q=2] q=""]]]]
413− ~zod/try=> (ker [[1 1] "\{}"])
414− [p=[p=1 q=1] q=~]
415−
416------------------------------------------------------------------------
34------------------------------------------------------------------------
417
35
418−### `++ket`
419−
420−Parse caret
421−
422−Parses ASCII character 94, the caret.
423−
424−Source
425−------
426−
427− ++ ket (just '^')
428−
429−Examples
430−--------
431−
432− ~zod/try=> (scan "^" ket)
433− ~~~5e.
434− ~zod/try=> `cord`(scan "^" ket)
435− '^'
436− ~zod/try=> (ket [[1 1] "^"])
437− [p=[p=1 q=2] q=[~ [p=~~~5e. q=[p=[p=1 q=2] q=""]]]]
438− ~zod/try=> (ket [[1 1] ".^"])
439− [p=[p=1 q=1] q=~]
440
36
441------------------------------------------------------------------------
37------------------------------------------------------------------------
442
38
443−### `++lus`
444−
445−Parse plus sign
446−
447−Parses ASCII character 43, the plus sign.
448−
449−Source
450−------
451−
452− ++ lus (just '+')
453−
454−Examples
455−--------
456−
457− ~zod/try=> (scan "+" lus)
458− ~~~2b.
459− ~zod/try=> `cord`(scan "+" lus)
460− '+'
461− ~zod/try=> (lus [[1 1] "+"])
462− [p=[p=1 q=2] q=[~ [p=~~~2b. q=[p=[p=1 q=2] q=""]]]]
463− ~zod/try=> (lus [[1 1] ".+"])
464− [p=[p=1 q=1] q=~]
465−
466------------------------------------------------------------------------
39------------------------------------------------------------------------
467
40
468−### `++hep`
469−
470−Parse hyphen
471−
472−Parses ASCII character 45, the hyphen.
473−
474−Source
475−------
476−
477− ++ hep (just '-')
478−
479−Examples
480−--------
481−
482− ~zod/try=> (scan "-" hep)
483− ~~-
484− ~zod/try=> `cord`(scan "-" hep)
485− '-'
486− ~zod/try=> (hep [[1 1] "-"])
487− [p=[p=1 q=2] q=[~ [p=~~- q=[p=[p=1 q=2] q=""]]]]
488− ~zod/try=> (hep [[1 1] ":-"])
489− [p=[p=1 q=1] q=~]
490−
491------------------------------------------------------------------------
41------------------------------------------------------------------------
492
42
493−### `++pel`
494−
495−Parse left parenthesis
496−
497−Parses ASCII character 40, the left parenthesis.
498−
499−Source
500−------
501−
502− ++ pel (just '(')
503−
504−Examples
505−--------
506−
507− ~zod/try=> (scan "(" pel)
508− ~~~28.
509− ~zod/try=> `cord`(scan "(" pel)
510− '('
511− ~zod/try=> (pel [[1 1] "("])
512− [p=[p=1 q=2] q=[~ [p=~~~28. q=[p=[p=1 q=2] q=""]]]]
513− ~zod/try=> (pel [[1 1] ";("])
514− [p=[p=1 q=1] q=~]
515−
516------------------------------------------------------------------------
43------------------------------------------------------------------------
517
44
518−### `++pam`
519−
520−Parse ampersand
521−
522−Parses ASCII character 38, the ampersand.
523−
524−Source
525−------
526−
527− ++ pam (just '&')
528−
529−Examples
530−--------
531−
532− ~zod/try=> (scan "&" pam)
533− ~~~26.
534− ~zod/try=> `cord`(scan "&" pam)
535− '&'
536− ~zod/try=> (pam [[1 1] "&"])
537− [p=[p=1 q=2] q=[~ [p=~~~26. q=[p=[p=1 q=2] q=""]]]]
538− ~zod/try=> (pam [[1 1] "?&"])
539− [p=[p=1 q=1] q=~]
540−
541------------------------------------------------------------------------
45------------------------------------------------------------------------
542
46
543−### `++per`
544−
545−Parse right parenthesis
546−
547−Parses ASCII character 41, the right parenthesis.
548−
549−Source
550−------
551−
552− ++ per (just ')')
553−
554−Examples
555−--------
556−
557− ~zod/try=> (scan ")" per)
558− ~~~29.
559− ~zod/try=> `cord`(scan ")" per)
560− ')'
561− ~zod/try=> (per [[1 1] ")"])
562− [p=[p=1 q=2] q=[~ [p=~~~29. q=[p=[p=1 q=2] q=""]]]]
563− ~zod/try=> (per [[1 1] " )"])
564− [p=[p=1 q=1] q=~]
565−
566------------------------------------------------------------------------
47------------------------------------------------------------------------
567
48
568−### `++pat`
569−
570−Parse "at" sign
571−
572−Parses ASCII character 64, the "at" sign.
573−
574−Source
575−------
576−
577− ++ pat (just '@')
578−
579−Examples
580−--------
581−
582− ~zod/try=> (scan "@" pat)
583− ~~~4.
584− ~zod/try=> `cord`(scan "@" pat)
585− '@'
586− ~zod/try=> (pat [[1 1] "@"])
587− [p=[p=1 q=2] q=[~ [p=~~~4. q=[p=[p=1 q=2] q=""]]]]
588− ~zod/try=> (pat [[1 1] "?@"])
589− [p=[p=1 q=1] q=~]
590−
591------------------------------------------------------------------------
49------------------------------------------------------------------------
592
50
593−### `++sel`
594−
595−Parse left square bracket
596−
597−Parses ASCII character 91, the left square bracket.
598−
599−Source
600−------
601−
602− ++ sel (just '[')
603−
604−Examples
605−--------
606−
607− ~zod/try=> (scan "[" sel)
608− ~~~5b.
609− ~zod/try=> `cord`(scan "[" sel)
610− '['
611− ~zod/try=> (sel [[1 1] "["])
612− [p=[p=1 q=2] q=[~ [p=~~~5b. q=[p=[p=1 q=2] q=""]]]]
613− ~zod/try=> (sel [[1 1] "-["])
614− [p=[p=1 q=1] q=~]
615−
616------------------------------------------------------------------------
51------------------------------------------------------------------------
617
52
618−### `++sem`
619−
620−Parse semicolon
621−
622−Parses ASCII character 59, the semicolon.
623−
624−Source
625−------
626−
627− ++ sem (just ';')
628−
629−Examples
630−--------
631−
632− ~zod/try=> (scan ";" sem)
633− ~~~3b.
634− ~zod/try=> `cord`(scan ";" sem)
635− ';'
636− ~zod/try=> (sem [[1 1] ";"])
637− [p=[p=1 q=2] q=[~ [p=~~~3b. q=[p=[p=1 q=2] q=""]]]]
638− ~zod/try=> (sem [[1 1] " ;"])
639− [p=[p=1 q=1] q=~]
640−
641------------------------------------------------------------------------
53------------------------------------------------------------------------
642
54
643−### `++ser`
644−
645−Parse right square bracket
646−
647−Parses ASCII character 93, the right square bracket.
648−
649−Source
650−------
651−
652− ++ ser (just ']')
653−
654−Examples
655−--------
656−
657− ~zod/try=> (scan "]" ser)
658− ~~~5d.
659− ~zod/try=> `cord`(scan "]" ser)
660− ']'
661− ~zod/try=> (ser [[1 1] "]"])
662− [p=[p=1 q=2] q=[~ [p=~~~5d. q=[p=[p=1 q=2] q=""]]]]
663− ~zod/try=> (ser [[1 1] "[ ]"])
664− [p=[p=1 q=1] q=~]
665−
666------------------------------------------------------------------------
55------------------------------------------------------------------------
667
56
668−### `++sig`
669−
670−Parse tilde
671−
672−Parses ASCII character 126, the tilde.
673−
674−Source
675−------
676−
677− ++ sig (just '~')
678−
679−Examples
680−--------
681−
682− ~zod/try=> (scan "~" sig)
683− ~~~~
684− ~zod/try=> `cord`(scan "~" sig)
685− '~'
686− ~zod/try=> (sig [[1 1] "~"])
687− [p=[p=1 q=2] q=[~ [p=~~~~ q=[p=[p=1 q=2] q=""]]]]
688− ~zod/try=> (sig [[1 1] "?~"])
689− [p=[p=1 q=1] q=~]
690−
691------------------------------------------------------------------------
57------------------------------------------------------------------------
692
58
693−### `++soq`
694−
695−Parse single quote
696−
697−Parses ASCII character 39, soq. Note the extra '' is to escape the first
698−`soq` because soq delimits a [`++cord`]().
699−
700−Source
701−------
702−
703− ++ soq (just '\'')
704−
705−Examples
706−--------
707−
708− ~zod/try=> (scan "'" soq)
709− ~~~27.
710− ~zod/try=> `cord`(scan "'" soq)
711− '''
712− ~zod/try=> (soq [[1 1] "'"])
713− [p=[p=1 q=2] q=[~ [p=~~~27. q=[p=[p=1 q=2] q=""]]]]
714− ~zod/try=> (soq [[1 1] ">'"])
715− [p=[p=1 q=1] q=~]
716−
717------------------------------------------------------------------------
59------------------------------------------------------------------------
718
60
719−### `++tar`
720−
721−Parse asterisk
722−
723−Parses ASCII character 42, the asterisk.
724−
725−Source
726−------
727−
728− ++ tar (just '*')
729−
730−Examples
731−--------
732−
733− ~zod/try=> (scan "*" tar)
734− ~~~2a.
735− ~zod/try=> `cord`(scan "*" tar)
736− '*'
737− ~zod/try=> (tar [[1 1] "*"])
738− [p=[p=1 q=2] q=[~ [p=~~~2a. q=[p=[p=1 q=2] q=""]]]]
739− ~zod/try=> (tar [[1 1] ".*"])
740− [p=[p=1 q=1] q=~]
741−
742------------------------------------------------------------------------
61------------------------------------------------------------------------
743
62
744−### `++tec`
745−
746−Parse backtick
747−
748−Parses ASCII character 96, the backtick (also known as the "grave
749−accent").
750−
751−Source
752−------
753−
754− ++ tec (just '`') :: backTiCk
755−
756−Examples
757−--------
758−
759− ~zod/try=> (scan "`" tec)
760− ~~~6.
761− ~zod/try=> `cord`(scan "`" tec)
762− '`'
763− ~zod/try=> (tec [[1 1] "`"])
764− [p=[p=1 q=2] q=[~ [p=~~~6. q=[p=[p=1 q=2] q=""]]]]
765− ~zod/try=> (tec [[1 1] " `"])
766− [p=[p=1 q=1] q=~]
767−
768------------------------------------------------------------------------
63------------------------------------------------------------------------
769
64
770−### `++tis`
771−
772−Parse equals sign
773−
774−Parses ASCII character 61, the equals sign.
775−
776−Source
777−------
778−
779− ++ tis (just '=')
780−
781−Examples
782−--------
783−
784− ~zod/try=> (scan "=" tis)
785− ~~~3d.
786− ~zod/try=> `cord`(scan "=" tis)
787− '='
788− ~zod/try=> (tis [[1 1] "="])
789− [p=[p=1 q=2] q=[~ [p=~~~3d. q=[p=[p=1 q=2] q=""]]]]
790− ~zod/try=> (tis [[1 1] "|="])
791− [p=[p=1 q=1] q=~]
792−
793------------------------------------------------------------------------
65------------------------------------------------------------------------
794
66
795−### `++wut`
796−
797−Parses question mark
798−
799−Parses ASCII character 63, the question mark.
800−
801−Source
802−------
803−
804− ++ wut (just '?')
805−
806−Examples
807−--------
808−
809− ~zod/try=> (scan "?" wut)
810− ~~~3f.
811− ~zod/try=> `cord`(scan "?" wut)
812− '?'
813− ~zod/try=> (wut [[1 1] "?"])
814− [p=[p=1 q=2] q=[~ [p=~~~3f. q=[p=[p=1 q=2] q=""]]]]
815− ~zod/try=> (wut [[1 1] ".?"])
816− [p=[p=1 q=1] q=~]
817−
818------------------------------------------------------------------------
67------------------------------------------------------------------------
819
68
820−### `++zap`
821−
822−Exclamation point
823−
824−Parses ASCII character 33, the exclamation point zap.
825−
826−Source
827−------
828−
829− ++ zap (just '!')
830−
831−Examples
832−--------
833−
834− ~zod/try=> (scan "!" zap)
835− ~~~21.
836− ~zod/try=> `cord`(scan "!" zap)
837− '!'
838− ~zod/try=> (zap [[1 1] "!"])
839− [p=[p=1 q=2] q=[~ [p=~~~21. q=[p=[p=1 q=2] q=""]]]]
840− ~zod/try=> (zap [[1 1] "?!"])
841− [p=[p=1 q=1] q=~]
842−
843------------------------------------------------------------------------
69------------------------------------------------------------------------
docs/system/hoon/library/2eg.md−191
@@ -1,211 +1,20 @@
12eG parsing (whitespace)
12eG parsing (whitespace)
2========================
2========================
3
3
4−### `++dog`
5−
6−`.` optional gap
7−
8−Dot followed by an optional gap, used with numbers.
9−
10−Source
11−------
12−
13− ++ dog ;~(plug dot gay) ::
14−
15−Examples
16−--------
17−
18− /~zod/try=> 1.234.
19− 703
20− 1.234.703
21− ~zod/try=> (scan "a. " ;~(pfix alf dog))
22− [~~~. ~]
23−
24------------------------------------------------------------------------
4------------------------------------------------------------------------
25
5
26−### `++doh`
27−
28−`@p` separator
29−
30−Phonetic base phrase separator
31−
32−Source
33−------
34−
35− ++ doh ;~(plug ;~(plug hep hep) gay) ::
36−
37−Examples
38−--------
39−
40− /~zod/try=> ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
41− ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
42− /~zod/try=> ~nopfel-botduc-nilnev-dolfyn--
43− haspub-natlun-lodmur-holtyd
44− ~nopfel-botduc-nilnev-dolfyn--haspub-natlun-lodmur-holtyd
45− ~zod/try=> (scan "--" doh)
46− [[~~- ~~-] ~]
47− ~zod/try=> (scan "-- " doh)
48− [[~~- ~~-] ~]
49−
50------------------------------------------------------------------------
6------------------------------------------------------------------------
51
7
52−### `++dun`
53−
54−`--` to `~`
55−
56−Parse phep, `--`, to null, `~`.
57−
58−Source
59−------
60−
61− ++ dun (cold ~ ;~(plug hep hep)) :: -- (phep) to ~
62−
63−Examples
64−--------
65−
66− ~zod/try=> (scan "--" dun)
67− ~
68− ~zod/try=> (dun [[1 1] "--"])
69− [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=""]]]]
70−
71------------------------------------------------------------------------
8------------------------------------------------------------------------
72−
73−### `++duz`
74−
75−`==` to `~`
76−
77−Parse stet, `==`, to null `~`.
78−
79−Source
80−------
81−
82− ++ duz (cold ~ ;~(plug tis tis)) :: == (stet) to ~
83−
84−Examples
85−--------
86−
87− ~zod/try=> (scan "==" duz)
88− ~
89− ~zod/try=> (duz [[1 1] "== |=..."])
90− [p=[p=1 q=3] q=[~ u=[p=~ q=[p=[p=1 q=3] q=" |=..."]]]]
91−
92------------------------------------------------------------------------
9------------------------------------------------------------------------
93−
94−### `++gah`
95−
96−Newline or ' '
97−
98−Whitespace component, either newline or space.
99−
100−Source
101−------
102−
103− ++ gah (mask [`@`10 ' ' ~]) :: newline or ace
104−
105−Examples
106−--------
107−
108− /~zod/try=> ^- * :: show spaces
109− """
110− -
111− -
112− -
113− """
114− [32 32 32 45 10 32 45 10 32 32 45 0]
115− /~zod/try=> ^- *
116− """
117−
118− """
119− [32 32 32 10 32 10 32 32 0]
120− /~zod/try=> ^- (list ,@)
121− %- scan :_ (star gah)
122− """
123−
124− """
125− ~[32 32 32 10 32 10 32 32]
126−
127------------------------------------------------------------------------
10------------------------------------------------------------------------
128
11
129−### `++gap`
130−
131−Plural whitespace
132−
133−Separates tall runes
134−
135−Source
136−------
137−
138− ++ gap (cold ~ ;~(plug gaq (star ;~(pose vul gah)))) :: plural whitespace
139−
140------------------------------------------------------------------------
12------------------------------------------------------------------------
141
13
142−### `++gaq`
143−
144−End of line
145−
146−Two spaces, a newline, or comment.
147−
148−Source
149−------
150−
151− ++ gaq ;~ pose :: end of line
152− (just `@`10)
153− ;~(plug gah ;~(pose gah vul))
154− vul
155− ==
156−
157−
158------------------------------------------------------------------------
14------------------------------------------------------------------------
159
15
160−### `++gaw`
161−
162−Classic whitespace
163−
164−Terran whitespace.
165−
166−Source
167−------
168−
169− ++ gaw (cold ~ (star ;~(pose vul gah))) :: classic white
170−
171------------------------------------------------------------------------
16------------------------------------------------------------------------
172
17
173−### `++gay`
174−
175−Optional gap
176−
177−Optional gap.
178−
179−Source
180−------
181−
182− ++ gay ;~(pose gap (easy ~)) ::
183−
184------------------------------------------------------------------------
18------------------------------------------------------------------------
185
19
186−### `++vul`
187−
188−Comments to null
189−
190−Source
191−------
192−
193− ++ vul %- cold :- ~ :: comments
194− ;~ plug col col
195− (star prn)
196− (just `@`10)
197− ==
198−
199−Parse comments and produce a null. Note that a comment must be ended
200−with a newline character.
201−
202−Examples
203−--------
204−
205− ~zod/try=> (scan "::this is a comment \0a" vul)
206− ~
207− ~zod/try=> (scan "::this is a comment " vul)
208− ! {1 21}
209− ! exit
210−
211------------------------------------------------------------------------
20------------------------------------------------------------------------
docs/system/hoon/library/2eh.md+4−528
@@ -1,576 +1,52 @@
12eH parsing (idioms)
12eH parsing (idioms)
2====================
2====================
3
3
4−### `++alf`
5−
6−Alphabetic characters
7−
8−Parse alphabetic characters, both upper and lowercase.
9−
10−Source
11−------
12−
13− ++ alf ;~(pose low hig) :: alphabetic
14−
15−Examples
16−--------
17−
18− ~zod/try=> (scan "a" alf)
19− ~~a
20− ~zod/try=> (scan "A" alf)
21− ~~~41.
22− ~zod/try=> (scan "AaBbCc" (star alf))
23− "AaBbCc"
24−
25------------------------------------------------------------------------
4------------------------------------------------------------------------
26
5
27−### `++aln`
28−
29−Alphanumeric characters
30−
31−Parse alphanumeric characters - both alphabetic characters and numbers.
32−
33−Source
34−------
35−
36− ++ aln ;~(pose low hig nud) :: alphanumeric
37−
38−Examples
39−--------
40−
41− ~zod/try=> (scan "0" aln)
42− ~~0
43− ~zod/try=> (scan "alf42" (star aln))
44− "alf42"
45− ~zod/try=> (scan "0123456789abcdef" (star aln))
46− "0123456789abcdef"
47−
48------------------------------------------------------------------------
6------------------------------------------------------------------------
49
7
50−### `++alp`
51−
52−Alphanumeric and `-`
53−
54−Parse alphanumeric strings and hep, "-".
55−
56−Source
57−------
58−
59− ++ alp ;~(pose low hig nud hep) :: alphanumeric and -
60−
61−Examples
62−--------
63−
64− ~zod/try=> (scan "7" alp)
65− ~~7
66− ~zod/try=> (scan "s" alp)
67− ~~s
68− ~zod/try=> (scan "123abc-" (star alp))
69− "123abc-"
70−
71------------------------------------------------------------------------
8------------------------------------------------------------------------
72−
73−### `++bet`
74−
75−Axis syntax `-`, `+`
76−
77−Parse the hep and lus axis syntax.
78−
79−Source
80−------
81−
82− ++ bet ;~(pose (cold 2 hep) (cold 3 lus)) :: axis syntax - +
83−
84−Examples
85−--------
86−
87− ~zod/try=> (scan "-" bet)
88− 2
89− ~zod/try=> (scan "+" bet)
90− 3
91−
92------------------------------------------------------------------------
9------------------------------------------------------------------------
93
10
94−### `++bin`
95−
96−Binary to atom
97−
98−Parse a tape of binary (0s and 1s) and produce its atomic representation.
99−
100−Source
101−------
102−
103− ++ bin (bass 2 (most gon but)) :: binary to atom
104−
105−Examples
106−--------
107−
108− ~zod/try=> (scan "0000" bin)
109− 0
110− ~zod/try=> (scan "0001" bin)
111− 1
112− ~zod/try=> (scan "0010" bin)
113− 2
114− ~zod/try=> (scan "100000001111" bin)
115− 2.063
116−
117------------------------------------------------------------------------
11------------------------------------------------------------------------
118
12
119−### `++but`
120−
121−Binary digit
122−
123−Parse a single binary digit.
124−
125−Source
126−------
127−
128− ++ but (cook |=(a=@ (sub a '0')) (shim '0' '1')) :: binary digit
129−
130−Examples
131−--------
132−
133− ~zod/try=> (scan "0" but)
134− 0
135− ~zod/try=> (scan "1" but)
136− 1
137− ~zod/try=> (scan "01" but)
138− ! {1 2}
139− ! 'syntax-error'
140− ! exit
141− ~zod/try=> (scan "01" (star but))
142− ~[0 1]
143−
144------------------------------------------------------------------------
13------------------------------------------------------------------------
145
14
146−### `++cit`
147−
148−Octal digit
149−
150−Parse a single octal digit.
151−
152−Source
153−------
154−
155− ++ cit (cook |=(a=@ (sub a '0')) (shim '0' '7')) :: octal digit
156−
157−Examples
158−--------
159−
160− ~zod/try=> (scan "1" cit)
161− 1
162− ~zod/try=> (scan "7" cit)
163− 7
164− ~zod/try=> (scan "8" cit)
165− ! {1 1}
166− ! 'syntax-error'
167− ! exit
168− ~zod/try=> (scan "60" (star cit))
169− ~[6 0]
170−
171------------------------------------------------------------------------
15------------------------------------------------------------------------
172
16
173−### `++dem`
174−
175−Decimal to atom
176−
177−Parse a decimal number to an atom.
178−
179−Source
180−------
181−
182− ++ dem (bass 10 (most gon dit)) :: decimal to atom
183−
184−Examples
185−--------
186−
187− ~zod/try=> (scan "7" dem)
188− 7
189− ~zod/try=> (scan "42" dem)
190− 42
191− ~zod/try=> (scan "150000000" dem)
192− 150.000.000
193− ~zod/try=> (scan "12456" dem)
194− 12.456
195−
196------------------------------------------------------------------------
17------------------------------------------------------------------------
197
18
198−### `++dit`
199−
200−Decimal digit
201−
202−Parse a single decimal digit.
203−
204−Source
205−------
206−
207− ++ dit (cook |=(a=@ (sub a '0')) (shim '0' '9')) :: decimal digit
208−
209−Examples
210−--------
211−
212− ~zod/try=> (scan "7" dit)
213− 7
214− ~zod/try=> (scan "42" (star dit))
215− ~[4 2]
216− ~zod/try=> (scan "26000" (star dit))
217− ~[2 6 0 0 0]
218−
219------------------------------------------------------------------------
19------------------------------------------------------------------------
220
20
221−### `++gul`
222−
223−Axis syntax `<` or `>`
224−
225−Parse the axis gal and gar axis syntax.
226−
227−Source
228−------
229−
230− ++ gul ;~(pose (cold 2 gal) (cold 3 gar)) :: axis syntax < >
231−
232−Examples
233−--------
234−
235− ~zod/try=> (scan "<" gul)
236− 2
237− ~zod/try=> (scan ">" gul)
238− 3
239−
240------------------------------------------------------------------------
21------------------------------------------------------------------------
241
22
242−### `++gon`
243−
244−Long numbers
245−
246−Parse long numbers - Numbers which wrap around the shell with the line
247−
248−Source
249−------
250−
251−break ++ gon ;~(pose ;~(plug bas gay fas) (easy ~)) :: long numbers \ /
252−
253−Examples
254−--------
255−characters bas and fas.
256−
257− ~zod/try=> (scan "\\/" gon)
258− [~~~5c. ~ ~~~2f.]
259− ~zod/try=> (gon [[1 1] "\\/"])
260− [p=[p=1 q=3] q=[~ u=[p=[~~~5c. ~ ~~~2f.] q=[p=[p=1 q=3] q=""]]]]
261−
262------------------------------------------------------------------------
23------------------------------------------------------------------------
263
24
264−### `++hex`
265−
266−Hex to atom
267−
268−Parse any hexadecimal number to an atom.
269−
270−Source
271−------
272−
273− ++ hex (bass 16 (most gon hit)) :: hex to atom
274−
275−Examples
276−--------
277−
278− ~zod/try=> (scan "a" hex)
279− 10
280− ~zod/try=> (scan "A" hex)
281− 10
282− ~zod/try=> (scan "2A" hex)
283− 42
284− ~zod/try=> (scan "1ee7" hex)
285− 7.911
286− ~zod/try=> (scan "1EE7" hex)
287− 7.911
288− ~zod/try=> (scan "1EE7F7" hex)
289− 2.025.463
290− ~zod/try=> `@ux`(scan "1EE7F7" hex)
291− 0x1e.e7f7
292
25
293------------------------------------------------------------------------
26------------------------------------------------------------------------
294
27
295−### `++hig`
296−
297−Uppercase
298−
299−Parse a single uppercase letter.
300−
301−Source
302−------
303−
304− ++ hig (shim 'A' 'Z') :: uppercase
305−
306−Examples
307−--------
308−
309− ~zod/try=> (scan "G" hig)
310− ~~~47.
311− ~zod/try=> `cord`(scan "G" hig)
312− 'G'
313− ~zod/try=> (scan "ABCDEFGHIJKLMNOPQRSTUVWXYZ" (star hig))
314− "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
315− ~zod/try=> (hig [[1 1] "G"])
316− [p=[p=1 q=2] q=[~ [p=~~~47. q=[p=[p=1 q=2] q=""]]]]
317−
318------------------------------------------------------------------------
28------------------------------------------------------------------------
319
29
320−### `++hit`
321−
322−Hex digits
323−
324−Parse a single hexadecimal digit.
325−
326−Source
327−------
328−
329− ++ hit ;~ pose :: hex digits
330− dit
331− (cook |=(a=char (sub a 87)) (shim 'a' 'f'))
332− (cook |=(a=char (sub a 55)) (shim 'A' 'F'))
333− ==
334−
335−Examples
336−--------
337−
338− ~zod/try=> (scan "a" hit)
339− 10
340− ~zod/try=> (scan "A" hit)
341− 10
342− ~zod/try=> (hit [[1 1] "a"])
343− [p=[p=1 q=2] q=[~ [p=10 q=[p=[p=1 q=2] q=""]]]]
344− ~zod/try=> (scan "2A" (star hit))
345− ~[2 10]
346
30
347------------------------------------------------------------------------
31------------------------------------------------------------------------
348
32
349−### `++low`
350−
351−Lowercase
352−
353−Parse a single lowercase letter.
354−
355−Source
356−------
357−
358− ++ low (shim 'a' 'z') :: lowercase
359−
360−Examples
361−--------
362−
363− ~zod/try=> (scan "g" low)
364− ~~g
365− ~zod/try=> `cord`(scan "g" low)
366− 'g'
367− ~zod/try=> (scan "abcdefghijklmnopqrstuvwxyz" (star low))
368− "abcdefghijklmnopqrstuvwxyz"
369− ~zod/try=> (low [[1 1] "g"])
370− [p=[p=1 q=2] q=[~ [p=~~g q=[p=[p=1 q=2] q=""]]]]
371−
372------------------------------------------------------------------------
33------------------------------------------------------------------------
373
34
374−### `++mes`
375−
376−Hexbyte
377−
378−Parse a hexbyte.
379−
380−Source
381−------
382−
383− ++ mes %+ cook :: hexbyte
384− |=([a=@ b=@] (add (mul 16 a) b))
385− ;~(plug hit hit)
386−
387−Examples
388−--------
389−
390− ~zod/try=> (scan "2A" mes)
391− 42
392− ~zod/try=> (mes [[1 1] "2A"])
393− [p=[p=1 q=3] q=[~ u=[p=42 q=[p=[p=1 q=3] q=""]]]]
394− ~zod/try=> (scan "42" mes)
395− 66
396−
397------------------------------------------------------------------------
35------------------------------------------------------------------------
398
36
399−### `++nix`
400−
401−Letters and `-`
402−
403−Parse Letters and `-`.
404−
405−Source
406−------
407−
408− ++ nix (boss 256 (star ;~(pose aln cab))) ::
409−
410−Examples
411−--------
412−
413− ~zod/try=> (scan "as_me" nix)
414− q=435.626.668.897
415− ~zod/try=> `@t`(scan "as_me" nix)
416− 'as_me'
417−
418------------------------------------------------------------------------
37------------------------------------------------------------------------
419
38
420−### `++nud`
421−
422−Numeric
423−
424−Parse a numeric character - A number.
425−
426−Source
427−------
428−
429− ++ nud (shim '0' '9') :: numeric
430−
431−Examples
432−--------
433−
434− ~zod/try=> (scan "0" nud)
435− ~~0
436− ~zod/try=> (scan "7" nud)
437− ~~7
438− ~zod/try=> (nud [[1 1] "1"])
439− [p=[p=1 q=2] q=[~ [p=~~1 q=[p=[p=1 q=2] q=""]]]]
440− ~zod/try=> (scan "0123456789" (star nud))
441− "0123456789"
442−
443------------------------------------------------------------------------
39------------------------------------------------------------------------
444
40
445−### `++prn`
446−
447−Printable character
448−
449−Parse any printable character.
450−
451−Source
452−------
453−
454− ++ prn ;~(less (just `@`127) (shim 32 256))
455−
456−Examples
457−--------
458−
459− ~zod/try=> (scan "h" prn)
460− ~~h
461− ~zod/try=> (scan "!" prn)
462− ~~~21.
463− ~zod/try=> (scan "\01" prn)
464− ! {1 1}
465− ! exit
466−
467------------------------------------------------------------------------
41------------------------------------------------------------------------
468
42
469−### `++qat`
470−
471−Chars in blockcord
472−
473−Parse character in cord block.
474−
475−Source
476−------
477−
478− ++ qat ;~ pose :: chars in blockcord
479− prn
480− ;~(less ;~(plug (just `@`10) soqs) (just `@`10))
481− ==
482−
483−Examples
484−--------
485−
486− ~zod/try=> (scan "h" qat)
487− ~~h
488− ~zod/try=> (scan "!" qat)
489− ~~~21.
490− ~zod/try=> (scan "\0a" qat)
491− ~~~a.
492− ~zod/try=> (scan "\00" qat)
493− ! {1 1}
494− ! exit
495−
496------------------------------------------------------------------------
43------------------------------------------------------------------------
497
44
498−### `++qit`
499−
500−Chars in cord
501−
502−Parse an individual character to its cord atom representation.
503−
504−Source
505−------
506−
507− ++ qit ;~ pose :: chars in a cord
508− ;~(less bas soq prn)
509− ;~(pfix bas ;~(pose bas soq mes)) :: escape chars
510− ==
511−
512−Examples
513−--------
514−
515− ~zod/try=> (scan "%" qit)
516− 37
517− ~zod/try=> `@t`(scan "%" qit)
518− '%'
519− ~zod/try=> (scan "0" qit)
520− 48
521− ~zod/try=> (scan "E" qit)
522− 69
523− ~zod/try=> (scan "a" qit)
524− 97
525− ~zod/try=> (scan "\\0a" qit)
526− 10
527− ~zod/try=> `@ux`(scan "\\0a" qit)
528− 0xa
529− ~zod/try=> (scan "cord" (star qit))
530− ~[99 111 114 100]
531−
532------------------------------------------------------------------------
45------------------------------------------------------------------------
533
46
534−### `++qut`
535−
536−Cord
537−
538−Parse single-soq cord with `\{gap}/` anywhere in the middle, or triple-single
539−quote (aka triple-soq) cord, between which must be in an indented block.
540−
541−Source
542−------
543−
544− ++ qut ;~ pose :: cord
545− ;~ less soqs
546− (ifix [soq soq] (boss 256 (more gon qit)))
547− ==
548− %- inde %+ ifix
549− :- ;~ plug soqs
550− ;~(pose ;~(plug (plus ace) vul) (just '\0a'))
551− ==
552− ;~(plug (just '\0a') soqs)
553− (boss 256 (star qat))
554− ==
555− ::
556−
557−Examples
558−--------
559−
560− ~zod/try=> (scan "'cord'" qut)
561− q=1.685.221.219
562− ~zod/try=> 'cord'
563− 'cord'
564− ~zod/try=> `@ud`'cord'
565− 1.685.221.219
566− /~zod/try=> '''
567− Heredoc isn't prohibited from containing quotes
568− '''
569− 'Heredoc isn't prohibited from containing quotes'
570−
571------------------------------------------------------------------------
47------------------------------------------------------------------------
572
48
573−### `++soqs`
49+### `++soz`
574
50
575Delimiting `'''`
51Delimiting `'''`
576
52
@@ -579,14 +55,14 @@ Parse a triple-single quote, used for multiline strings.
579Source
55Source
580------
56------
581
57
582− ++ soqs ;~(plug soq soq soq) :: delimiting '''
58+ ++ soz ;~(plug soq soq soq) :: delimiting '''
583
59
584Examples
60Examples
585--------
61--------
586
62
587− ~zod/try=> (scan "'''" soqs)
63+ ~zod/try=> (scan "'''" soz)
588 [~~~27. ~~~27. ~~~27.]
64 [~~~27. ~~~27. ~~~27.]
589− ~zod/try=> (rash '"""' soqs)
65+ ~zod/try=> (rash '"""' soz)
590 ! {1 1}
66 ! {1 1}
591 ! exit
67 ! exit
592
68
docs/system/hoon/library/2ej.md−774
@@ -1,813 +1,39 @@
12eJ formatting (basic text)
12eJ formatting (basic text)
2===========================
2===========================
3
3
4−### `++cass`
5−
6−To lowercase
7−
8−Produce the case insensitive (all lowercase) [`++cord`]() of a [`++tape`]().
9−
10−Accepts
11−-------
12−
13−`vib` is a `++tape`.
14−
15−Produces
16−--------
17−
18−A `++cord`.
19−
20−Source
21−------
22−
23− ++ cass :: lowercase
24− |= vib=tape
25− %+ rap 3
26− (turn vib |=(a=@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
27− ::
28−
29−Examples
30−--------
31−
32− ~zod/try=> (cass "john doe")
33− 7.309.170.810.699.673.450
34− ~zod/try=> `cord`(cass "john doe")
35− 'john doe'
36− ~zod/try=> (cass "abc, 123, !@#")
37− 2.792.832.775.110.938.439.066.079.945.313
38− ~zod/try=> `cord`(cass "abc, 123, !@#")
39− 'abc, 123, !@#'
40−
41------------------------------------------------------------------------
4------------------------------------------------------------------------
42
5
43−### `++cuss`
44−
45−To uppercase
46−
47−Turn all occurances of lowercase letters in any [`++tape`]() into uppercase
48−letters, as a [`++cord`]().
49−
50−Accepts
51−-------
52−
53−`vib` is a `++tape`.
54−
55−Produces
56−--------
57−
58−A `++cord`.
59−
60−Source
61−------
62−
63− ++ cuss :: uppercase
64− |= vib=tape
65− ^- @t
66− %+ rap 3
67− (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
68− ::
69−
70−Examples
71−--------
72−
73− ~zod/try=> (cuss "john doe")
74− 'JOHN DOE'
75− ~zod/try=> (cuss "abc ABC 123 !@#")
76− 'ABC ABC 123 !@#'
77− ~zod/try=> `@ud`(cuss "abc")
78− 4.407.873
79− ~zod/try=> (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
80− 'AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ'
81
6
82------------------------------------------------------------------------
7------------------------------------------------------------------------
83
8
84−### `++crip`
85−
86−Tape to cord
87−
88−Produce a [`++cord`]() from a [`++tape`]().
89−
90−Accepts
91−-------
92−
93−`a` is a `++tape`.
94−
95−Produces
96−--------
97−
98−A `++cord`.
99−
100−Source
101−------
102−
103− ++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord
104−
105−Examples
106−--------
107−
108− ~zod/try=> (crip "john doe")
109− 'john doe'
110− ~zod/try=> (crip "abc 123 !@#")
111− 'abc 123 !@#'
112− ~zod/try=> `@ud`(crip "abc")
113− 6.513.249
114
9
115------------------------------------------------------------------------
10------------------------------------------------------------------------
116
11
117−### `++mesc`
118−
119−Escape special chars
120−
121−Escape special characters, used in [`++show`](/doc/hoon/library/2ez#++show)
122−
123−Accepts
124−-------
125−
126−`vib` is a [`++tape`]().
127−
128−Produces
129−--------
130−
131−A `++tape`.
132−
133−Source
134−------
135−
136− ++ mesc :: ctrl code escape
137− |= vib=tape
138− ^- tape
139− ?~ vib
140− ~
141− ?: =('\\' i.vib)
142− ['\\' '\\' $(vib t.vib)]
143− ?: ?|((gth i.vib 126) (lth i.vib 32) =(39 i.vib))
144− ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
145− [i.vib $(vib t.vib)]
146− ::
147−
148−Examples
149−--------
150−
151− /~zod/try=> (mesc "ham lus")
152− "ham lus"
153− /~zod/try=> (mesc "bas\\hur")
154− "bas\\\\hur"
155− /~zod/try=> (mesc "as'saß")
156− "as\0x27/sa\0xc3/\0x9f/"
157−
158------------------------------------------------------------------------
12------------------------------------------------------------------------
159
13
160−### `++runt`
161−
162−Prepend `n` times
163−
164−Add `a` repetitions of character `b` to the head of [`++tape`]() `c`.
165−
166−Accepts
167−-------
168−
169−`a` and `b` are atoms.
170−
171−`c` is a `++tape`.
172−
173−Produces
174−--------
175−
176−A `++tape`.
177−
178−Source
179−------
180−
181− ++ runt :: prepend repeatedly
182− |= [[a=@ b=@] c=tape]
183− ^- tape
184− ?: =(0 a)
185− c
186− [b $(a (dec a))]
187− ::
188−
189−Examples
190−--------
191−
192− /~zod/try=> (runt [2 '/'] "ham")
193− "//ham"
194− /~zod/try=> (runt [10 'a'] "")
195− "aaaaaaaaaa"
196−
197------------------------------------------------------------------------
14------------------------------------------------------------------------
198
15
199−### `++sand`
200−
201−Soft-cast by odor
202−
203−Soft-cast validity by [odor]().
204−
205−Accepts
206−-------
207−
208−`a` is a [`++span`]() (`@ta`).
209−
210−`b` is an atom.
211−
212−Produces
213−--------
214−
215−A `(unit ,@)`.
216−
217−Source
218−------
219−
220− ++ sand :: atom sanity
221− |= a=@ta
222− |= b=@ ^- (unit ,@)
223− ?.(((sane a) b) ~ [~ b])
224− ::
225−
226−Examples
227−--------
228−
229− /~zod/try=> `(unit ,@ta)`((sand %ta) 'sym-som')
230− [~ ~.sym-som]
231− /~zod/try=> `(unit ,@ta)`((sand %ta) 'err!')
232− ~
233−
234------------------------------------------------------------------------
16------------------------------------------------------------------------
235
17
236−### `++sane`
237−
238−Check odor validity
239−
240−Check validity by [odor](). Produces a [gate]().
241−
242−Accepts
243−-------
244−
245−`a` is a [`++span`]() (`@ta`).
246−
247−`b` is an [atom]().
248−
249−Produces
250−--------
251−
252−A boolean.
253−
254−Source
255−------
256−
257− ++ sane :: atom sanity
258− |= a=@ta
259− |= b=@ ^- ?
260− ?. =(%t (end 3 1 a))
261− ~|(%sane-stub !!)
262− =+ [inx=0 len=(met 3 b)]
263− ?: =(%tas a)
264− |- ^- ?
265− ?: =(inx len) &
266− =+ cur=(cut 3 [inx 1] b)
267− ?& ?| &((gte cur 'a') (lte cur 'z'))
268− &(=('-' cur) !=(0 inx) !=(len inx))
269− &(&((gte cur '0') (lte cur '9')) !=(0 inx))
270− ==
271− $(inx +(inx))
272− ==
273− ?: =(%ta a)
274− |- ^- ?
275− ?: =(inx len) &
276− =+ cur=(cut 3 [inx 1] b)
277− ?& ?| &((gte cur 'a') (lte cur 'z'))
278− &((gte cur '0') (lte cur '9'))
279− |(=('-' cur) =('~' cur) =('_' cur) =('.' cur))
280− ==
281− $(inx +(inx))
282− ==
283− |- ^- ?
284− ?: =(0 b) &
285− =+ cur=(end 3 1 b)
286− ?: &((lth cur 32) !=(10 cur)) |
287− =+ len=(teff cur)
288− ?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i)))))))
289− $(b (rsh 3 len b))
290− ==
291− ::
292−
293−Examples
294−--------
295−
296− /~zod/try=> ((sane %tas) %mol)
297− %.y
298− /~zod/try=> ((sane %tas) 'lam')
299− %.y
300− /~zod/try=> ((sane %tas) 'more ace')
301− %.n
302−
303------------------------------------------------------------------------
18------------------------------------------------------------------------
304
19
305−### `++trim`
306−
307−Tape split
308−
309−Split first `a` characters off [`++tape`]() `b`.
310−
311−Accepts
312−-------
313−
314−`a` is an atom.
315−
316−`b` is a `++tape`.
317−
318−Produces
319−--------
320−
321−A cell of `++tape`s, `p` and `q`.
322−
323−Source
324−------
325−
326− ++ trim :: tape split
327− |= [a=@ b=tape]
328− ^- [p=tape q=tape]
329− ?~ b
330− [~ ~]
331− ?: =(0 a)
332− [~ b]
333− =+ c=$(a (dec a), b t.b)
334− [[i.b p.c] q.c]
335− ::
336−
337−Examples
338−--------
339−
340− /~zod/try=> (trim 5 "lasok termun")
341− [p="lasok" q=" termun"]
342− /~zod/try=> (trim 5 "zam")
343− [p="zam" q=""]
344−
345------------------------------------------------------------------------
20------------------------------------------------------------------------
346
21
347−### `++trip`
348−
349−Cord to tape
350−
351−Produce a [`++tape`]() from [`++cord`]().
352−
353−Accepts
354−-------
355−
356−`a` is an atom.
357−
358−Produces
359−--------
360−
361−A `++tape`.
362−
363−Source
364−------
365−
366− ++ trip :: cord to tape
367− ~/ %trip
368− |= a=@ ^- tape
369− ?: =(0 (met 3 a))
370− ~
371− [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
372− ::
373−
374−Examples
375−--------
376−
377− /~zod/try=> (trip 'john doe')
378− "john doe"
379− /~zod/try=> (trip 'abc 123 !@#')
380− "abc 123 !@#"
381− /~zod/try=> (trip 'abc')
382− "abc"
383−
384------------------------------------------------------------------------
22------------------------------------------------------------------------
385
23
386−### `++teff`
387−
388−UTF8 Length
389−
390−Produces the number of utf8 bytes.
391−
392−Accepts
393−-------
394−
395−`a` is a [`@t`]().
396−
397−Produces
398−--------
399−
400−An atom.
401−
402−Source
403−------
404−
405− ++ teff :: length utf8
406− |= a=@t ^- @
407− =+ b=(end 3 1 a)
408− ?: =(0 b)
409− ?>(=(0 a) 0)
410− ?> |((gte b 32) =(10 b))
411− ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
412− ::
413−
414−Examples
415−--------
416−
417− /~zod/try=> (teff 'a')
418− 1
419− /~zod/try=> (teff 'ß')
420− 2
421−
422------------------------------------------------------------------------
24------------------------------------------------------------------------
423
25
424−### `++turf`
425−
426−UTF8 to UTF32 cord
427−
428−Convert utf8 ([`++cord`]()) to utf32 codepoints.
429−
430−Accepts
431−-------
432−
433−`a` is a [`@t`]().
434−
435−Produces
436−--------
437−
438−A [`@c`](), UTF-32 codepoint.
439−
440−Source
441−------
442−
443− ++ turf :: utf8 to utf32
444− |= a=@t
445− ^- @c
446− %+ rap 5
447− |- ^- (list ,@c)
448− =+ b=(teff a)
449− ?: =(0 b) ~
450− :- %+ can 0
451− %+ turn
452− ^- (list ,[p=@ q=@])
453− ?+ b !!
454− 1 [[0 7] ~]
455− 2 [[8 6] [0 5] ~]
456− 3 [[16 6] [8 6] [0 4] ~]
457− 4 [[24 6] [16 6] [8 6] [0 3] ~]
458− ==
459− |=([p=@ q=@] [q (cut 0 [p q] a)])
460− $(a (rsh 3 b a))
461− ::
462−
463−Examples
464−--------
465−
466− /~zod/try=> (turf 'my ßam')
467− ~-my.~df.am
468− /~zod/try=> 'я тут'
469− 'я тут'
470− /~zod/try=> (turf 'я тут')
471− ~-~44f..~442.~443.~442.
472− /~zod/try=> `@ux`'я тут'
473− 0x82.d183.d182.d120.8fd1
474− /~zod/try=> `@ux`(turf 'я тут')
475− 0x442.0000.0443.0000.0442.0000.0020.0000.044f
476−
477------------------------------------------------------------------------
26------------------------------------------------------------------------
478
27
479−### `++tuba`
480−
481−UTF8 to UTF32 tape
482−
483−Convert [`++tape`]() to a [`++list`]() of codepoints ([`@c`]()).
484−
485−Accepts
486−-------
487−
488−`a` is a `++tape`.
489−
490−Produces
491−--------
492−
493−A `++list` of codepoints [`@c`]().
494−
495−Source
496−------
497−
498− ++ tuba :: utf8 to utf32 tape
499− |= a=tape
500− ^- (list ,@c)
501− (rip 5 (turf (rap 3 a))) :: XX horrible
502− ::
503−
504−Examples
505−--------
506−
507− /~zod/try=> (tuba "я тут")
508− ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
509− /~zod/try=> (tuba "chars")
510− ~[~-c ~-h ~-a ~-r ~-s]
511−
512------------------------------------------------------------------------
28------------------------------------------------------------------------
513
29
514−### `++tufa`
515−
516−UTF32 to UTF8 tape
517−
518−Wrap a [`++list`]() of utf32 codepoints into a utf8 [`++tape`]().
519−
520−Accepts
521−-------
522−
523−`a` is a `++list` of [`@c`]().
524−
525−Produces
526−--------
527−
528−A `++tape`.
529−
530−Source
531−------
532−
533− ++ tufa :: utf32 to utf8 tape
534− |= a=(list ,@c)
535− ^- tape
536− ?~ a ""
537− (weld (rip 3 (tuft i.a)) $(a t.a))
538− ::
539−
540−Examples
541−--------
542−
543− /~zod/try=> (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
544− "я тут"
545− /~zod/try=> (tufa ((list ,@c) ~[%a %b 0xb1 %c]))
546− "ab±c"
547−
548------------------------------------------------------------------------
30------------------------------------------------------------------------
549
31
550−### `++tuft`
551−
552−UTF32 to UTF8 text
553−
554−Convert utf32 glyph to
555−[LSB](http://en.wikipedia.org/wiki/Least_significant_bit) utf8 [`++cord`]().
556−
557−Accepts
558−-------
559−
560−`a` is a codepoint ([`@c`]()).
561−
562−Produces
563−--------
564−
565−A `++cord`.
566−
567−Source
568−------
569−
570− ++ tuft :: utf32 to utf8 text
571− |= a=@c
572− ^- @t
573− %+ rap 3
574− |- ^- (list ,@)
575− ?: =(0 a)
576− ~
577− =+ b=(end 5 1 a)
578− =+ c=$(a (rsh 5 1 a))
579− ?: (lth b 0x7f)
580− [b c]
581− ?: (lth b 0x7ff)
582− :* (mix 0b1100.0000 (cut 0 [6 5] b))
583− (mix 0b1000.0000 (end 0 6 b))
584− c
585− ==
586− ?: (lth b 0xffff)
587− :* (mix 0b1110.0000 (cut 0 [12 4] b))
588− (mix 0b1000.0000 (cut 0 [6 6] b))
589− (mix 0b1000.0000 (end 0 6 b))
590− c
591− ==
592− :* (mix 0b1111.0000 (cut 0 [18 3] b))
593− (mix 0b1000.0000 (cut 0 [12 6] b))
594− (mix 0b1000.0000 (cut 0 [6 6] b))
595− (mix 0b1000.0000 (end 0 6 b))
596− c
597− ==
598− ::
599−
600−Examples
601−--------
602−
603− /~zod/try=> (tuft `@c`%a)
604− 'a'
605− /~zod/try=> (tuft `@c`0xb6)
606− '¶'
607−
608------------------------------------------------------------------------
32------------------------------------------------------------------------
609
33
610−### `++wack`
611−
612−Coin format encode
613−
614−Escape [`++span`]() `~` as `~~` and `_` as `~-`. Used for printing.
615−
616−Accepts
617−-------
618−
619−`a` is a `++span` (`@ta`).
620−
621−Produces
622−--------
623−
624−A [`++span`]() (`@ta`).
625−
626−Source
627−------
628−
629− ++ wack :: coin format
630− |= a=@ta
631− ^- @ta
632− =+ b=(rip 3 a)
633− %+ rap 3
634− |- ^- tape
635− ?~ b
636− ~
637− ?: =('~' i.b) ['~' '~' $(b t.b)]
638− ?: =('_' i.b) ['~' '-' $(b t.b)]
639− [i.b $(b t.b)]
640− ::
641−
642−Examples
643−--------
644−
645− /~zod/try=> (wack '~20_sam~')
646− ~.~~20~-sam~~
647− /~zod/try=> `@t`(wack '~20_sam~')
648− '~~20~-sam~~'
649− ~zod/try=> ~(rend co %many ~[`ud/5 `ta/'~20_sam'])
650− "._5_~~.~~20~-sam__"
651− ~zod/try=> ._5_~~.~~20~-sam__
652− [5 ~.~20_sam]
653−
654------------------------------------------------------------------------
34------------------------------------------------------------------------
655
35
656−### `++wick`
657−
658−Coin format decode
659−
660−Unescape [`++span`]() `~~` as `~` and `~-` as `_`.
661−
662−Accepts
663−-------
664−
665−`a` is a an [atom]().
666−
667−Produces
668−--------
669−
670−A [`++span`]() `@ta`.
671−
672−Source
673−------
674−
675− ++ wick :: coin format
676− |= a=@
677− ^- @ta
678− =+ b=(rip 3 a)
679− %+ rap 3
680− |- ^- tape
681− ?~ b
682− ~
683− ?: =('~' i.b)
684− ?~ t.b !!
685− [?:(=('~' i.t.b) '~' ?>(=('-' i.t.b) '_')) $(b t.t.b)]
686− [i.b $(b t.b)]
687− ::
688−
689−Examples
690−--------
691−
692− /~zod/try=> `@t`(wick '~-ams~~lop')
693− '_ams~lop'
694− /~zod/try=> `@t`(wick (wack '~20_sam~'))
695− '~20_sam~'
696−
697------------------------------------------------------------------------
36------------------------------------------------------------------------
698
37
699−### `++woad`
700−
701−Unescape cord
702−
703−Unescape [`++cord`]() codepoints.
704−
705−Accepts
706−-------
707−
708−`a` is a [`@ta`]().
709−
710−Produces
711−--------
712−
713−A [`++cord`]().
714−
715−Source
716−------
717−
718− ++ woad :: cord format
719− |= a=@ta
720− ^- @t
721− %+ rap 3
722− |- ^- (list ,@)
723− ?: =(0 a)
724− ~
725− =+ b=(end 3 1 a)
726− =+ c=(rsh 3 1 a)
727− ?: =('.' b)
728− [' ' $(a c)]
729− ?. =('~' b)
730− [b $(a c)]
731− => .(b (end 3 1 c), c (rsh 3 1 c))
732− ?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d))
733− ^= d
734− =+ d=0
735− |- ^- [p=@ q=@]
736− ?: =('.' b)
737− [d c]
738− ?< =(0 c)
739− %= $
740− b (end 3 1 c)
741− c (rsh 3 1 c)
742− d %+ add (mul 16 d)
743− %+ sub b
744− ?: &((gte b '0') (lte b '9')) 48
745− ?>(&((gte b 'a') (lte b 'z')) 87)
746− ==
747− %'.' ['.' $(a c)]
748− %'~' ['~' $(a c)]
749− ==
750− ::
751−
752−Examples
753−--------
754−
755− /~zod/try=> (woad ~.~b6.20.as)
756− '¶20 as'
757−
758------------------------------------------------------------------------
38------------------------------------------------------------------------
759
39
760−### `++wood`
761−
762−Escape cord
763−
764−Escape [`++cord`]() codepoints.
765−
766−Accepts
767−-------
768−
769−`a` is a [`++span`]() (`@ta`).
770−
771−Produces
772−--------
773−
774−A [`++span`]() (`@ta`).
775−
776−Source
777−------
778−
779− ++ wood :: cord format
780− |= a=@t
781− ^- @ta
782− %+ rap 3
783− |- ^- (list ,@)
784− ?: =(0 a)
785− ~
786− =+ b=(teff a)
787− =+ c=(turf (end 3 b a))
788− =+ d=$(a (rsh 3 b a))
789− ?: ?| &((gte c 'a') (lte c 'z'))
790− &((gte c '0') (lte c '9'))
791− =('-' c)
792− ==
793− [c d]
794− ?+ c
795− :- '~'
796− =+ e=(met 2 c)
797− |- ^- tape
798− ?: =(0 c)
799− ['.' d]
800− =. e (dec e)
801− =+ f=(rsh 2 e c)
802− [(add ?:((lte f 9) 48 87) f) $(c (end 2 e c))]
803− ::
804− %' ' ['.' d]
805− %'.' ['~' '.' d]
806− %'~' ['~' '~' d]
807− ==
808−
809−Examples
810−--------
811−
812− /~zod/try=> (wood 'my ßam')
813− ~.my.~df.am
docs/system/hoon/library/2ek.md−259
@@ -1,264 +1,5 @@
12eK formatting (layout)
12eK formatting (layout)
2=======================
2=======================
3
3
4−### `++re`
5−
6−Pretty-printing engine
7−
8−Pretty-printing engine that accepts a [`++tank`](/doc/hoon/library/1#++tank) [sample]() and contains arms that perform computation on it.
9−
10−Accepts
11−-------
12−
13−`tac` is a `++tank`.
14−
15−Produces
16−--------
17−
18− ++ re
19− |_ tac=tank
20−
21−Examples
22−--------
23−
24− /~zod/try=> ~(. re leaf/"ham")
25− <2.ghl [[%leaf ""] <414.gly 100.xkc 1.ypj %164>]>
26−
27−### `++ram`
28−
29−Flatten to tape
30−
31−Flatten [`++tank`]() out into a [`++tape`]().
32−
33−Accepts
34−-------
35−
36−`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
37−
38−Produces
39−--------
40−
41−A `++tape`.
42−
43−Source
44−------
45−
46− ++ ram
47− ^- tape
48− ?- -.tac
49− %leaf p.tac
50− %palm ram(tac [%rose [p.p.tac (weld q.p.tac r.p.tac) s.p.tac] q.tac])
51− %rose
52− %+ weld
53− q.p.tac
54− |- ^- tape
55− ?~ q.tac
56− r.p.tac
57− =+ voz=$(q.tac t.q.tac)
58− (weld ram(tac i.q.tac) ?~(t.q.tac voz (weld p.p.tac voz)))
59− ==
60− ::
61−
62−Examples
63−--------
64−
65− /~zod/try=> ~(ram re leaf/"foo")
66− "foo"
67− /~zod/try=> ~(ram re rose/["." "(" ")"]^~[leaf/"bar" leaf/"baz" leaf/"bam"])
68− "(bar.baz.bam)"
69−
70−### `++win`
71−
72−Render at indent
73−
74−Render at indent level `tab` and width `edg`.
75−
76−Accepts
77−-------
78−
79−`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
80−
81−`tab` and `edg` are atoms.
82−
83−Produces
84−--------
85−
86−A [`++wall`]() ([`++list`]() of [`++tapes`]()).
87−
88−Source
89−------
90−
91− ++ win
92− |= [tab=@ edg=@]
93− =+ lug=`wall`~
94− |^ |- ^- wall
95− ?- -.tac
96− %leaf (rig p.tac)
97− %palm
98− ?: fit
99− (rig ram)
100− ?~ q.tac
101− (rig q.p.tac)
102− ?~ t.q.tac
103− (rig(tab (add 2 tab), lug $(tac i.q.tac)) q.p.tac)
104− => .(q.tac `(list tank)`q.tac)
105− =+ lyn=(mul 2 (lent q.tac))
106− =+ ^= qyr
107− |- ^- wall
108− ?~ q.tac
109− lug
110− %= ^$
111− tac i.q.tac
112− tab (add tab (sub lyn 2))
113− lug $(q.tac t.q.tac, lyn (sub lyn 2))
114− ==
115− (wig(lug qyr) q.p.tac)
116− ::
117− %rose
118− ?: fit
119− (rig ram)
120− =+ ^= gyl
121− |- ^- wall
122− ?~ q.tac
123− ?:(=(%$ r.p.tac) lug (rig r.p.tac))
124− ^$(tac i.q.tac, lug $(q.tac t.q.tac), tab din)
125− ?: =(%$ q.p.tac)
126− gyl
127− (wig(lug gyl) q.p.tac)
128− ==
129− ::
130−
131−Examples
132−--------
133−
134− /~zod/try=> (~(win re leaf/"samoltekon-lapdok") 0 20)
135− <<"samoltekon-lapdok">>
136− /~zod/try=> (~(win re leaf/"samoltekon-lapdok") 0 10)
137− <<"\/samolt\/" " ekon-l" " apdok" "\/ \/">>
138− /~zod/try=> (~(win re rose/["--" "[" "]"]^~[leaf/"1423" leaf/"2316"]) 0 20)
139− <<"[1423--2316]">>
140− /~zod/try=> (~(win re rose/["--" "[" "]"]^~[leaf/"1423" leaf/"2316"]) 0 10)
141− <<"[ 1423" " 2316" "]">>
142−
143−### `++din`
144−
145−XX document
146−
147−Accepts
148−-------
149−
150−Produces
151−--------
152−
153−Source
154−------
155−
156− ++ din (mod (add 2 tab) (mul 2 (div edg 3)))
157−
158−
159−----------------------------------------------------------------------
160−
161−### `++fit`
162−
163−Fit on one line test
164−
165−Determine whether `tac` fits on one line. Internal to `++win`
166−
167−Accepts
168−-------
169−
170−Produces
171−--------
172−
173−Source
174−------
175−
176−++ fit (lte (lent ram) (sub edg tab))
177−
178−
179−Examples
180−--------
181−
182−
183−
184−
185−----------------------------------------------------------------------
186−
187−### `++rig`
188−
189−Wrap in `\/`
190−
191−Wrap [`++tape`]() in `\/` if it doesn't fit at current indentation. Internal to
192−[`++win`]()
193−
194−Accepts
195−-------
196−
197−`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
198−
199−`hom` is a `++tape`.
200−
201−Produces
202−--------
203−
204−A [`++wall`]() (list of `++tape`s).
205−
206−Source
207−------
208−
209− ++ rig
210− |= hom=tape
211− ^- wall
212− ?: (lte (lent hom) (sub edg tab))
213− [(runt [tab ' '] hom) lug]
214− => .(tab (add tab 2), edg (sub edg 2))
215− =+ mut=(trim (sub edg tab) hom)
216− :- (runt [(sub tab 2) ' '] ['\\' '/' (weld p.mut `_hom`['\\' '/' ~])])
217− => .(hom q.mut)
218− |-
219− ?~ hom
220− :- %+ runt
221− [(sub tab 2) ' ']
222− ['\\' '/' (runt [(sub edg tab) ' '] ['\\' '/' ~])]
223− lug
224− => .(mut (trim (sub edg tab) hom))
225− [(runt [tab ' '] p.mut) $(hom q.mut)]
226− ::
227−
228−Examples
229−--------
230−
231−### `++wig`
232−
233−`++win` render tape
234−
235−Render [`++tape`](). Internal to [`++win`]().
236−
237−Accepts
238−-------
239−
240−`tac` is a `++tank`, taken from [sample]() of `++re` [core]().
241−
242−`hom` is a `++tape`.
243−
244−Produces
245−--------
246−
247− ++ wig
248− |= hom=tape
249− ^- wall
250− ?~ lug
251− (rig hom)
252− =+ lin=(lent hom)
253− =+ wug=:(add 1 tab lin)
254− ?. =+ mir=i.lug
255− |- ?~ mir
256− |
257− ?|(=(0 wug) ?&(=(' ' i.mir) $(mir t.mir, wug (dec wug))))
258− (rig hom) :: ^ XX regular form?
259− [(runt [tab ' '] (weld hom `tape`[' ' (slag wug i.lug)])) t.lug]
260− --
261− --
262−
263Examples
4Examples
264--------
5--------
docs/system/hoon/library/2el.md−2830
@@ -1,2863 +1,33 @@
12eL formatting (path)
12eL formatting (path)
2=====================
2=====================
3
3
4−### `++ab`
5−
6−Primitive parser engine
7−
8−A core containing numeric parser primitives.
9−
10−Source
11−------
12−
13− ++ ab
14− |%
15−
16−Examples
17−--------
18−
19− ~zod/try=> ab
20− <36.ecc 414.gly 100.xkc 1.ypj %164>
21−
22−------------------------------------------------------------------------
23−
24−### `++bix`
25−
26−Parse hex pair
27−
28−Parsing [`++rule`](). Parses a pair of base-16 digits. Used in escapes.
29−
30−Accepts
31−-------
32−
33−XX
34−
35−Produces
36−--------
37−
38−A an atom. XX
39−
40−Source
41−------
42−
43− ++ bix (bass 16 (stun [2 2] six))
44−
45−Examples
46−--------
47−
48− ~zod/try=> (scan "07" bix:ab)
49− q=7
50− ~zod/try=> (scan "51" bix:ab)
51− q=81
52− ~zod/try=> (scan "a3" bix:ab)
53− q=163
54−
55−------------------------------------------------------------------------
56−
57−### `++hif`
58−
59−Parse phonetic pair
60−
61−Parsing [`++rule`](). Parses an atom of [odor]() [`@pE`](), a phrase of two bytes
62−encoded phonetically.
63−
64−Accepts
65−-------
66−
67−XX
68−
69−Produces
70−--------
71−
72−An atom.
73−
74−Source
75−------
76−
77− ++ hif (boss 256 ;~(plug tip tiq (easy ~)))
78−
79−Examples
80−--------
81−
82− ~zod/try=> (scan "doznec" hif:ab)
83− q=256
84− ~zod/try=> (scan "pittyp" hif:ab)
85− q=48.626
86−
87−------------------------------------------------------------------------
88−
89−### `++huf`
90−
91−Parse two phonetic pairs
92−
93−Parsing [`++rule`](). Parses and unscrambles an atom of odor [@pF](), a phrase
94−of two two-byte pairs that are encoded (and scrambled) phonetically.
95−
96−Accepts
97−-------
98−
99−XX
100−
101−Produces
102−--------
103−
104−An atom. XX
105−
106−Source
107−------
108−
109− ++ huf %+ cook
110− |=([a=@ b=@] (wred:un ~(zug mu ~(zag mu [a b]))))
111− ;~(plug hif ;~(pfix hep hif))
112−
113−Examples
114−--------
115−
116− ~zod/try=> (scan "pittyp-pittyp" huf:ab)
117− 328.203.557
118− ~zod/try=> (scan "tasfyn-partyv" huf:ab)
119− 65.792
120− ~zod/try=> `@ux`(scan "tasfyn-partyv" huf:ab)
121− 0x1.0100
122−
123−------------------------------------------------------------------------
124−
125−### `++hyf`
126−
127−Parse 8 phonetic bytes
128−
129−Parsing [`++rule`](). Parses an atom of odor [@pG](), a phrase of eight of
130−phonetic bytes.
131−
132−Accepts
133−-------
134−
135−An atom of odor [`@pG`]()
136−
137−Produces
138−--------
139−
140−An atom. XX
141−
142−Source
143−------
144−
145− ++ hyf (bass 0x1.0000.0000 ;~(plug huf ;~(pfix hep huf) (easy ~)))
146−
147−Examples
148−--------
149−
150− ~zod/try=> (scan "sondel-forsut-tillyn-nillyt" hyf:ab)
151− q=365.637.097.828.335.095
152− ~zod/try=> `@u`~sondel-forsut-tillyn-nillyt
153− 365.637.097.828.335.095
154−
155−------------------------------------------------------------------------
156−
157−### `++pev`
158−
159−Parse \<= 5 base-32
160−
161−Parsing [`++rule`](). Parses up to five base-32 digits without a leading zero.
162−
163−Accepts
164−-------
165−
166−Up to five [@uv]() (base 64) digits.
167−
168−Produces
169−--------
170−
171−An atom.
172−
173−Source
174−------
175−
176− ++ pev (bass 32 ;~(plug sev (stun [0 4] siv)))
177−
178−Examples
179−--------
180−
181− ~zod/try=> (scan "a" pev:ab)
182− q=10
183− ~zod/try=> (scan "290j" pev:ab)
184− q=74.771
185− ~zod/try=> (scan "123456" pev:ab)
186− ! {1 6}
187− ! exit
188− ~zod/try=> (scan "090j" pev:ab)
189− ~ <syntax error at [1 11]>
190−
191−------------------------------------------------------------------------
192−
193−### `++pew`
194−
195−Parse \<= 5 base-64
196−
197−Parsing [`++rule`](). Parses up to five base-64 digits without a leading zero.
198−
199−Accepts
200−-------
201−
202−Up to five [@uw]() (base 64) digits.
203−
204−Produces
205−--------
206−
207−
208−
209−Source
210−------
211−
212− ++ pew (bass 64 ;~(plug sew (stun [0 4] siw)))
213−
214−Examples
215−--------
216−
217− ~zod/try=> (scan "Q" pew:ab)
218− q=52
219− ~zod/try=> (scan "aQ~9" pew:ab)
220− q=2.838.473
221− ~zod/try=> `@`0waQ~9
222− 2.838.473
223− ~zod/try=> (scan "123456" pew:ab)
224− ! {1 6}
225− ! exit
226− ~zod/try=> (scan "012345" pew:ab)
227− ! {1 1}
228− ! exit
229−
230−------------------------------------------------------------------------
231−
232−### `++piv`
233−
234−Parse 5 base-32
235−
236−Parsing [`++rule`](). Parses exactly five base-32 digits.
237−
238−Accepts
239−-------
240−
241−Produces
242−--------
243−
244−Source
245−------
246−
247− ++ piv (bass 32 (stun [5 5] siv))
248−
249−Examples
250−--------
251−
252− ~zod/try=> (scan "10b3l" piv:ab)
253− q=1.059.957
254− ~zod/try=> (scan "1" piv:ab)
255− ! {1 2}
256− ! exit
257−
258−------------------------------------------------------------------------
259−
260−### `++piw`
261−
262−Parse 5 base-64
263−
264−Parsing [`++rule`](). Parses exactly five base-64 digits.
265−
266−Accepts
267−-------
268−
269−Produces
270−--------
271−
272−My name henry let's see how fast I can type.
273−
274−Source
275−------
276−
277− ++ piw (bass 64 (stun [5 5] siw))
278−
279−Examples
280−--------
281−
282− ~zod/try=> (scan "2C-pZ" piw:ab)
283− q=43.771.517
284− ~zod/try=> (scan "2" piv:ab)
285− ! {1 2}
286− ! exit
287−
288−------------------------------------------------------------------------
289−
290−### `++qeb`
291−
292−Parse \<= 4 binary
293−
294−Parsing [`++rule`](). Parses a binary number of up to 4 digits in length without
295−a leading zero.
296−
297−Accepts
298−-------
299−
300−Produces
301−--------
302−
303−Source
304−------
305−
306− ++ qeb (bass 2 ;~(plug seb (stun [0 3] sib)))
307−
308−Examples
309−--------
310−
311− ~zod/try=> (scan "1" qeb:ab)
312− q=1
313− ~zod/try=> (scan "101" qeb:ab)
314− q=5
315− ~zod/try=> (scan "1111" qeb:ab)
316− q=15
317− ~zod/try=> (scan "11111" qeb:ab)
318− ! {1 5}
319− ! exit
320− ~zod/try=> (scan "01" qeb:ab)
321− ! {1 1}
322− ! exit
323−
324−------------------------------------------------------------------------
325−
326−### `++qex`
327−
328−Parse \<= 4 hex
329−
330−Parsing [`++rule`](). Parses a hexadecimal number of up to 4 digits in length
331−without a leading zero.
332−
333−Accepts
334−-------
335−
336−Produces
337−--------
338−
339−Source
340−------
341−
342− ++ qex (bass 16 ;~(plug sex (stun [0 3] hit)))
343−
344−Examples
345−--------
346−
347− ~zod/try=> (scan "ca" qex:ab)
348− q=202
349− ~zod/try=> (scan "18ac" qex:ab)
350− q=6.316
351− ~zod/try=> (scan "18acc" qex:ab)
352− ! {1 5}
353− ! exit
354− ~zod/try=> (scan "08ac" qex:ab)
355− ! {1 1}
356− ! exit
357−
358−------------------------------------------------------------------------
359−
360−### `++qib`
361−
362−Parse 4 binary
363−
364−Parsing [`++rule`](). Parses exactly four binary digits.
365−
366−Accepts
367−-------
368−
369−Produces
370−--------
371−
372−Source
373−------
374−
375− ++ qib (bass 2 (stun [4 4] sib))
376−
377−Examples
378−--------
379−
380− ~zod/try=> (scan "0001" qib:ab)
381− q=1
382− ~zod/try=> (scan "0100" qib:ab)
383− q=4
384− ~zod/try=> (scan "110" qib:ab)
385− ! {1 4}
386− ! exit
387−
388−------------------------------------------------------------------------
389−
390−### `++qix`
391−
392−Parse 4 hex
393−
394−Parsing [`++rule`](). Parses exactly four hexadecimal digits.
395−
396−Accepts
397−-------
398−
399−Produces
400−--------
401−
402−Source
403−------
404−
405− ++ qix (bass 16 (stun [4 4] six))
406−
407−Examples
408−--------
409−
410− ~zod/try=> (scan "0100" qix:ab)
411− q=256
412− ~zod/try=> (scan "10ff" qix:ab)
413− q=4.351
414− ~zod/try=> (scan "0" qix:ab)
415− ! {1 2}
416− ! exit
417−
418−------------------------------------------------------------------------
419−
420−### `++seb`
421−
422−Parse 1
423−
424−Parsing [`++rule`](). Parses the number 1.
425−
426−Accepts
427−-------
428−
429−Produces
430−--------
431−
432−Source
433−------
434−
435− ++ seb (cold 1 (just '1'))
436−
437−Examples
438−--------
439−
440− ~zod/try=> (scan "1" seb:ab)
441− 1
442− ~zod/try=> (scan "0" seb:ab)
443− ! ~zod/try/~2014.10.23..22.34.21..bfdd/:<[1 1].[1 18]>
444− ! {1 1}
445− ~zod/try=> (scan "2" seb:ab)
446− ! ~zod/try/~2014.10.23..22.34.29..d399/:<[1 1].[1 18]>
447− ! {1 1}
448−
449−------------------------------------------------------------------------
450−
451−### `++sed`
452−
453−Parse decimal
454−
455−Parsing [`++rule`](). Parses a nonzero decimal digit.
456−
457−Accepts
458−-------
459−
460−Produces
461−--------
462−
463−Source
464−------
465−
466− ++ sed (cook |=(a=@ (sub a '0')) (shim '1' '9'))
467−
468−Examples
469−--------
470−
471− ~zod/try=> (scan "5" sed:ab)
472− 5
473− ~zod/try=> (scan "0" sed:ab)
474− ! {1 1}
475− ! exit
476−
477−------------------------------------------------------------------------
478−
479−### `++sev`
480−
481−Parse base-32
482−
483−Parsing [`++rule`](). Parses a nonzero base-32 digit
484−
485−Accepts
486−-------
487−
488−Produces
489−--------
490−
491−Source
492−------
493−
494− ++ sev ;~(pose sed sov)
495−
496−Examples
497−--------
498−
499− ~zod/try=> (scan "c" sev:ab)
500− 12
501− ~zod/socialnet=> (scan "0" sev:ab)
502− ! {1 1}
503− ! exit
504−
505−------------------------------------------------------------------------
506−
507−### `++sew`
508−
509−Parse base-64
510−
511−Parsing [`++rule`](). Parses a nonzero base-64 digit
512−
513−Accepts
514−-------
515−
516−Produces
517−--------
518−
519−Source
520−------
521−
522− ++ sew ;~(pose sed sow)
523−
524−Examples
525−--------
526−
527− ~zod/try=> (scan "M" sew:ab)
528− 48
529− ~zod/try=> (scan "0" sew:ab)
530− ! {1 1}
531− ! exit
532−
533−------------------------------------------------------------------------
534−
535−### `++sex`
536−
537−Parse hex
538−
539−Parsing [`++rule`](). Parses a nonzero hexadecimal digit.
540−
541−Accepts
542−-------
543−
544−Produces
545−--------
546−
547−Source
548−------
549−
550− ++ sex ;~(pose sed sox)
551−
552−Examples
553−--------
554−
555− ~zod/try=> (scan "e" sex:ab)
556− 14
557− ~zod/try=> (scan "0" sex:ab)
558− ! {1 1}
559− ! exit
560−
561−------------------------------------------------------------------------
562−
563−### `++sib`
564−
565−Parse binary
566−
567−Parsing [`++rule`](). Parses a binary digit.
568−
569−Accepts
570−-------
571−
572−Produces
573−--------
574−
575−Source
576−------
577−
578− ++ sib (cook |=(a=@ (sub a '0')) (shim '0' '1'))
579−
580−Examples
581−--------
582−
583− ~zod/try=> (scan "1" sib:ab)
584− 1
585− ~zod/socialnet=> (scan "0" sib:ab)
586− 0
587−
588−------------------------------------------------------------------------
589−
590−### `++sid`
591−
592−Parse decimal
593−
594−Parsing [`++rule`](). Parses a decimal digit.
595−
596−Accepts
597−-------
598−
599−Produces
600−--------
601−
602−Source
603−------
604−
605− ++ sid (cook |=(a=@ (sub a '0')) (shim '0' '9'))
606−
607−Examples
608−--------
609−
610− ~zod/try=> (scan "5" sid:ab)
611− 5
612−
613−------------------------------------------------------------------------
614−
615−### `++siv`
616−
617−Parse base-32
618−
619−Parsing [`++rule`](). Parses a base-32 digit.
620−
621−Accepts
622−-------
623−
624−Produces
625−--------
626−
627−Source
628−------
629−
630− ++ siv ;~(pose sid sov)
631−
632−Examples
633−--------
634−
635− ~zod/try=> (scan "c" siv:ab)
636− 12
637−
638−------------------------------------------------------------------------
639−
640−### `++siw`
641−
642−Parse base-64
643−
644−Parsing [`++rule`](). Parses a base-64 digit.
645−
646−Accepts
647−-------
648−
649−Produces
650−--------
651−
652−Source
653−------
654−
655− ++ siw ;~(pose sid sow)
656−
657−Examples
658−--------
659−
660− ~zod/try=> (scan "M" siw:ab)
661− 48
662−
663−------------------------------------------------------------------------
664−
665−### `++six`
666−
667−Parse hex
668−
669−Parsing [`++rule`](). Parses a hexadecimal digit.
670−
671−Accepts
672−-------
673−
674−Produces
675−--------
676−
677−Source
678−------
679−
680− ++ six ;~(pose sid sox)
681−
682−Examples
683−--------
684−
685− ~zod/try=> (scan "e" six:ab)
686− 14
687−
688−------------------------------------------------------------------------
689−
690−### `++sov`
691−
692−Parse base-32
693−
694−Parsing [`++rule`](). Parses a base-32 letter.
695−
696−Accepts
697−-------
698−
699−Produces
700−--------
701−
702−Source
703−------
704−
705− ++ sov (cook |=(a=@ (sub a 87)) (shim 'a' 'v'))
706−
707−Examples
708−--------
709−
710− ~zod/try=> (scan "c" sov:ab)
711− 12
712−
713−------------------------------------------------------------------------
714−
715−### `++sow`
716−
717−Parse base-64
718−
719−Parsing [`++rule`](). Parses a base-64 letter/symbol.
720−
721−Accepts
722−-------
723−
724−Produces
725−--------
726−
727−Source
728−------
729−
730− ++ sow ;~ pose
731− (cook |=(a=@ (sub a 87)) (shim 'a' 'z'))
732− (cook |=(a=@ (sub a 29)) (shim 'A' 'Z'))
733− (cold 62 (just '-'))
734− (cold 63 (just '~'))
735− ==
736−
737−Examples
738−--------
739−
740− ~zod/try=> (scan "M" sow:ab)
741− 48
742−
743−------------------------------------------------------------------------
744−
745−### `++sox`
746−
747−Parse hex letter
748−
749−Parsing [`++rule`](). Parses a hexadecimal letter.
750−
751−Accepts
752−-------
753−
754−Produces
755−--------
756−
757−Source
758−------
759−
760− ++ sox (cook |=(a=@ (sub a 87)) (shim 'a' 'f'))
761−
762−Examples
763−--------
764−
765− ~zod/try=> (scan "e" sox:ab)
766− 14
767−
768−------------------------------------------------------------------------
769−
770−### `++ted`
771−
772−Parse \<= 3 decimal
773−
774−Parsing [`++rule`](). Parses a decimal number of up to 3 digits without a
775−leading zero.
776−
777−Accepts
778−-------
779−
780−Produces
781−--------
782−
783−Source
784−------
785−
786− ++ ted (bass 10 ;~(plug sed (stun [0 2] sid)))
787−
788−Examples
789−--------
790−
791− ~zod/try=> (scan "21" ted:ab)
792− q=21
793− ~zod/try=> (scan "214" ted:ab)
794− q=214
795− ~zod/try=> (scan "2140" ted:ab)
796− {1 4}
797− ~zod/try=> (scan "0" ted:ab)
798− ! {1 1}
799− ! exit
800−
801−------------------------------------------------------------------------
802−
803−### `++tip`
804−
805−Leading phonetic byte
806−
807−Parsing [`++rule`](). Parses the leading phonetic byte, which represents a
808−syllable.
809−
810−Accepts
811−-------
812−
813−Produces
814−--------
815−
816−Source
817−------
818−
819− ++ tip (sear |=(a=@ (ins:po a)) til)
820−
821−Examples
822−--------
823−
824− ~zod/try=> (scan "doz" tip:ab)
825− 0
826− ~zod/try=> (scan "pit" tip:ab)
827− 242
828−
829−------------------------------------------------------------------------
830−
831−### `++tiq`
832−
833−Trailing phonetic syllable
834−
835−Parsing [`++rule`](). Parses the trailing phonetic byte, which represents a
836−syllable.
837−
838−Accepts
839−-------
840−
841−Produces
842−--------
843−
844−Source
845−------
846−
847− ++ tiq (sear |=(a=@ (ind:po a)) til)
848−
849−Examples
850−--------
851−
852− ~zod/try=> (scan "zod" tiq:ab)
853− 0
854− ~zod/try=> (scan "nec" tiq:ab)
855− 1
856−
857−------------------------------------------------------------------------
858−
859−### `++tid`
860−
861−Parse 3 decimal digits
862−
863−Parsing [`++rule`](). Parses exactly three decimal digits.
864−
865−Accepts
866−-------
867−
868−Produces
869−--------
870−
871−Source
872−------
873−
874− ++ tid (bass 10 (stun [3 3] sid))
875−
876−Examples
877−--------
878−
879− ~zod/try=> (scan "013" tid:ab)
880− q=13
881− ~zod/try=> (scan "01" tid:ab)
882− ! {1 3}
883− ! exit
884−
885−------------------------------------------------------------------------
886−
887−### `++til`
888−
889−Parse 3 lowercase
890−
891−Parsing [`++rule`](). Parses exactly three lowercase letters.
892−
893−Accepts
894−-------
895−
896−Produces
897−--------
898−
899−Source
900−------
901−
902− ++ til (boss 256 (stun [3 3] low))
903−
904−Examples
905−--------
906−
907− ~zod/try=> (scan "mer" til:ab)
908− q=7.497.069
909− ~zod/try=> `@t`(scan "mer" til:ab)
910− 'mer'
911− ~zod/try=> (scan "me" til:ab)
912− ! {1 3}
913− ! exit
914−
915−------------------------------------------------------------------------
916−
917−### `++urs`
918−
919−Parse span characters
920−
921−Parsing rule. Parses characters from an atom of the span odor [`@ta`]().
922−
923−Accepts
924−-------
925−
926−Produces
927−--------
928−
929−Source
930−------
931−
932− ++ urs %+ cook
933− |=(a=tape (rap 3 ^-((list ,@) a)))
934− (star ;~(pose nud low hep dot sig cab))
935−
936−Examples
937−--------
938−
939− ~zod/try=> `@ta`(scan "asa-lom_tak" urs:ab)
940− ~.asa-lom_tak
941− ~zod/try=> `@t`(scan "asa-lom_tak" urs:ab)
942− 'asa-lom_tak'
943−
944−------------------------------------------------------------------------
945−
946−### `++urt`
947−
948−Parse non-`_` span
949−
950−Parsing rule. Parses all characters of the span odor [`@ta`]() except
951−for cab, `_`.
952−
953−Accepts
954−-------
955−
956−Produces
957−--------
958−
959−Source
960−------
961−
962− ++ urt %+ cook
963− |=(a=tape (rap 3 ^-((list ,@) a)))
964− (star ;~(pose nud low hep dot sig))
965−
966−Examples
967−--------
968−
969− ~zod/try=> `@t`(scan "asa-lom.t0k" urt:ab)
970− 'asa-lom.t0k'
971−
972−------------------------------------------------------------------------
973−
974−### `++voy`
975−
976−Parse bas, soq, or bix
977−
978−Parsing rule. Parses an escaped backslash, single quote, or hex pair
979−byte.
980−
981−Accepts
982−-------
983−
984−Produces
985−--------
986−
987−Source
988−------
989−
990− ++ voy ;~(pfix bas ;~(pose bas soq bix))
991−
992−Examples
993−--------
994−
995− ~zod/try=> (scan "\\0a" voy:ab)
996− q=10
997− ~zod/try=> (scan "\\'" voy:ab)
998− q=39
999−
1000−------------------------------------------------------------------------
1001−
1002−### `++ag`
1003−
1004−Top-level atom parser engine
1005−
1006−A core containing top-level atom parsers.
1007−
1008−Accepts
1009−-------
1010−
1011−Produces
1012−--------
1013−
1014−Source
1015−------
1016−
1017− ++ ag
1018− |%
1019−
1020−Examples
1021−--------
1022−
1023− ~zod/try=> ag
1024− <14.vpu 414.mof 100.xkc 1.ypj %164>
1025−
1026−------------------------------------------------------------------------
1027−
1028−### `++ape`
1029−
1030−Parse 0 or rule
1031−
1032−Parser modifier. Parses 0 or the sample rule `fel`.
1033−
1034−Accepts
1035−-------
1036−
1037−Produces
1038−--------
1039−
1040−`fel` is a [`rule`]().
1041−
1042−Source
1043−------
1044−
1045− ++ ape |*(fel=_rule ;~(pose (cold 0 (just '0')) fel))
1046−
1047−Examples
1048−--------
1049−
1050− ~zod/try=> (scan "202" (star (ape:ag (cold 2 (just '2')))))
1051− ~[2 0 2]
1052−
1053−------------------------------------------------------------------------
1054−
1055−### `++bay`
1056−
1057−Parses binary number
1058−
1059−Parsing rule. Parses a binary number without a leading zero.
1060−
1061−Accepts
1062−-------
1063−
1064−Produces
1065−--------
1066−
1067−Source
1068−------
1069−
1070− ++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab)))))
1071−
1072−Examples
1073−--------
1074−
1075− ~zod/try=> (scan "10.0110" bay:ag)
1076− q=38
1077−
1078−------------------------------------------------------------------------
1079−
1080−### `++bip`
1081−
1082−Parse IPv6
1083−
1084−Parsing rule. Parses a [`@is`](), an IPv6 address.
1085−
1086−Accepts
1087−-------
1088−
1089−Produces
1090−--------
1091−
1092−Source
1093−------
1094−
1095− ++ bip =+ tod=(ape qex:ab)
1096− (bass 0x1.0000 ;~(plug tod (stun [7 7] ;~(pfix dog tod))))
1097−
1098−Examples
1099−--------
1100−
1101− ~zod/try=> (scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1102− q=283.183.420.760.121.105.516.068.864
1103− ~zod/try=> `@is`(scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1104− .0.0.ea.3e6c.0.0.0.0
1105−
1106−------------------------------------------------------------------------
1107−
1108−### `++dem`
1109−
1110−Parse decimal with dots
1111−
1112−Parsing rule. Parses a decimal number that includes dot separators.
1113−
1114−Accepts
1115−-------
1116−
1117−Produces
1118−--------
1119−
1120−Source
1121−------
1122−
1123− ++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab)))))
1124−
1125−Examples
1126−--------
1127−
1128− ~zod/try=> (scan "52" dem:ag)
1129− q=52
1130− ~zod/try=> (scan "13.507" dem:ag)
1131− q=13.507
1132−
1133−------------------------------------------------------------------------
1134−
1135−### `++dim`
1136−
1137−Parse decimal number
1138−
1139−Parsing rule. Parses a decimal number without a leading zero.
1140−
1141−Accepts
1142−-------
1143−
1144−Produces
1145−--------
1146−
1147−Source
1148−------
1149−
1150− ++ dim (ape (bass 10 ;~(plug sed:ab (star sid:ab))))
1151−
1152−Examples
1153−--------
1154−
1155− ~zod/try=> (scan "52" dim:ag)
1156− q=52
1157− ~zod/try=> (scan "013507" dim:ag)
1158− ! {1 2}
1159− ! exit
1160−
1161−------------------------------------------------------------------------
1162−
1163−### `++dum`
1164−
1165−Parse decimal with leading `0`
1166−
1167−Parsing rule. Parses a decmial number with leading zeroes.
1168−
1169−Accepts
1170−-------
1171−
1172−Produces
1173−--------
1174−
1175−Source
1176−------
1177−
1178− ++ dum (bass 10 (plus sid:ab))
1179−
1180−Examples
1181−--------
1182−
1183− ~zod/try=> (scan "52" dum:ag)
1184− q=52
1185− ~zod/try=> (scan "0000052" dum:ag)
1186− q=52
1187− ~zod/try=> (scan "13507" dim:ag)
1188− q=13.507
1189−
1190−------------------------------------------------------------------------
1191−
1192−### `++fed`
1193−
1194−Parse phonetic base
1195−
1196−Parsing rule. Parses an atom of odor [`@p`](), the phonetic base.
1197−
1198−Accepts
1199−-------
1200−
1201−Produces
1202−--------
1203−
1204−Source
1205−------
1206−
1207− ++ fed ;~ pose
1208− (bass 0x1.0000.0000.0000.0000 (most doh hyf:ab))
1209− huf:ab
1210− hif:ab
1211− tiq:ab
1212− ==
1213−
1214−Examples
1215−--------
1216−
1217− ~zod/try=> (scan "zod" fed:ag)
1218− 0
1219− ~zod/try=> (scan "nec" fed:ag)
1220− 1
1221− ~zod/try=> (scan "sondel" fed:ag)
1222− 9.636
1223− ~zod/try=> ~tillyn-nillyt
1224− ~tillyn-nillyt
1225− ~zod/try=> (scan "tillyn-nillyt" fed:ag)
1226− 3.569.565.175
1227− ~zod/try=> (scan "tillyn-nillyt-tasfyn-partyv" fed:ag)
1228− 15.331.165.687.565.582.592
1229− ~zod/try=> (scan "tillyn-nillyt-tasfyn-partyv--novweb-talrud-talmud-sonfyr" fed:ag)
1230− 282.810.089.790.159.633.869.501.053.313.363.681.181
1231−
1232−------------------------------------------------------------------------
1233−
1234−### `++hex`
1235−
1236−Parse hex
1237−
1238−Parsing rule. Parses a hexadecimal number
1239−
1240−Accepts
1241−-------
1242−
1243−Produces
1244−--------
1245−
1246−Source
1247−------
1248−
1249− ++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab)))))
1250−
1251−Examples
1252−--------
1253−
1254− ~zod/try=> (scan "4" hex:ag)
1255− q=4
1256− ~zod/try=> (scan "1a" hex:ag)
1257− q=26
1258− ~zod/try=> (scan "3.ac8d" hex:ag)
1259− q=240.781
1260− ~zod/try=> `@ux`(scan "3.ac8d" hex:ag)
1261− 0x3.ac8d
1262−
1263−------------------------------------------------------------------------
1264−
1265−### `++lip`
1266−
1267−Parse IPv4 address
1268−
1269−Parsing rule. Parses an IPv4 address.
1270−
1271−Accepts
1272−-------
1273−
1274−Produces
1275−--------
1276−
1277−Source
1278−------
1279−
1280− ++ lip =+ tod=(ape ted:ab)
1281− (bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod))))
1282−
1283−Examples
1284−--------
1285−
1286− ~zod/try=> (scan "127.0.0.1" lip:ag)
1287− q=2.130.706.433
1288− ~zod/try=> `@if`(scan "127.0.0.1" lip:ag)
1289− .127.0.0.1
1290− ~zod/try=> `@if`(scan "8.8.8.8" lip:ag)
1291− .8.8.8.8
1292−
1293−------------------------------------------------------------------------
1294−
1295−### `++viz`
1296−
1297−Parse Base-32 with dots
1298−
1299−Parsing rule. Parses a Base-32 number with dot separators.
1300−
1301−Accepts
1302−-------
1303−
1304−Produces
1305−--------
1306−
1307−Source
1308−------
1309−
1310− ++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
1311−
1312−Examples
1313−--------
1314−
1315− ~zod/try=> (scan "e2.ol4pm" viz:ag)
1316− q=15.125.353.270
1317−
1318−------------------------------------------------------------------------
1319−
1320−### `++vum`
1321−
1322−Parse base-32 string
1323−
1324−Parsing rule. Parses a raw base-32 string.
1325−
1326−Accepts
1327−-------
1328−
1329−Produces
1330−--------
1331−
1332−Source
1333−------
1334−
1335− ++ vum (bass 32 (plus siv:ab))
1336−
1337−Examples
1338−--------
1339−
1340− ~zod/try=> (scan "e2ol4pm" vum:ag)
1341− q=15.125.353.270
1342−
1343−------------------------------------------------------------------------
1344−
1345−### `++wiz`
1346−
1347−Parse base-64
1348−
1349−Parsing rule. Parses a base-64 number.
1350−
1351−Accepts
1352−-------
1353−
1354−Produces
1355−--------
1356−
1357−Source
1358−------
1359−
1360− ++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab)))))
1361− --
1362− ::
1363−
1364−Examples
1365−--------
1366−
1367− ~zod/try=> (scan "e2O.l4Xpm" wiz:ag)
1368− q=61.764.130.813.526
1369−
1370−------------------------------------------------------------------------
1371−
1372−### `++co`
1373−
1374−Literal rendering engine
1375−
1376−A [door]() that contains arms that operate on the sample coin `lot`.
1377−
1378−Accepts
1379−-------
1380−
1381−Produces
1382−--------
1383−
1384−`lot` is a [`++coin`]().
1385−
1386−Source
1387−------
1388−
1389− ++ co
1390− =< |_ lot=coin
1391−
1392−Examples
1393−--------
1394−
1395− ~zod/try=> ~(. co many/~[`ta/'mo' `ud/5])
1396− < 3.dhd
1397− [ [ %many
1398− [%~ %ta @t]
1399− [%~ %ud @ud]
1400− %~
1401− ]
1402− <10.utz 3.zid [rex="" <414.hmb 100.xkc 1.ypj %164>]>
1403− ]
1404− >
1405−
1406−------------------------------------------------------------------------
1407−
1408−### `++rear`
1409−
1410−Prepend & render as tape
1411−
1412−Renders a coin `lot` as a [tape]() prepended to the sample tape `rom`.
1413−
1414−Accepts
1415−-------
1416−
1417−Produces
1418−--------
1419−
1420−`rom` is a [`pe`]()
1421−
1422−`lot` is a [`++coin`]().
1423−
1424−Source
1425−------
1426−
1427− ++ rear |=(rom=tape =>(.(rex rom) rend))
1428−
1429−Examples
1430−--------
1431−
1432− ~zod/try=> (~(rear co %$ %ux 200) "--ha")
1433− "0xc8--ha"
1434−
1435−------------------------------------------------------------------------
1436−
1437−### `++rent`
1438−
1439−Render as span
1440−
1441−Renders a coin `lot` as a span.
1442−
1443−Accepts
1444−-------
1445−
1446−Produces
1447−--------
1448−
1449−`lot` is a [`++coin`]().
1450−
1451−Source
1452−------
1453−
1454− ++ rent `@ta`(rap 3 rend)
1455−
1456−Examples
1457−--------
1458−
1459− ~zod/try=> ~(rent co %$ %ux 200)
1460− ~.0xc8
1461− ~zod/try=> `@t`~(rent co %$ %ux 200)
1462− '0xc8'
1463−
1464−------------------------------------------------------------------------
1465−
1466−### `++rend`
1467−
1468−Render as tape
1469−
1470−Renders a coin `lot` as a tape.
1471−
1472−Accepts
1473−-------
1474−
1475−Produces
1476−--------
1477−
1478−`lot` is a [`++coin`]().
1479−
1480−Source
1481−------
1482−
1483− ++ rend
1484− ^- tape
1485− ?: ?=(%blob -.lot)
1486− ['~' '0' ((v-co 1) (jam p.lot))]
1487− ?: ?=(%many -.lot)
1488− :- '.'
1489− |- ^- tape
1490− ?~ p.lot
1491− ['_' '_' rex]
1492− ['_' (weld (trip (wack rent(lot i.p.lot))) $(p.lot t.p.lot))]
1493− =+ [yed=(end 3 1 p.p.lot) hay=(cut 3 [1 1] p.p.lot)]
1494− |- ^- tape
1495− ?+ yed (z-co q.p.lot)
1496− %c ['~' '-' (weld (rip 3 (wood (tuft q.p.lot))) rex)]
1497− %d
1498− ?+ hay (z-co q.p.lot)
1499− %a
1500− =+ yod=(yore q.p.lot)
1501− => ^+(. .(rex ?~(f.t.yod rex ['.' (s-co f.t.yod)])))
1502− => ^+ .
1503− %= .
1504− rex
1505− ?: &(=(~ f.t.yod) =(0 h.t.yod) =(0 m.t.yod) =(0 s.t.yod))
1506− rex
1507− => .(rex ['.' (y-co s.t.yod)])
1508− => .(rex ['.' (y-co m.t.yod)])
1509− ['.' '.' (y-co h.t.yod)]
1510− ==
1511− => .(rex ['.' (a-co d.t.yod)])
1512− => .(rex ['.' (a-co m.yod)])
1513− => .(rex ?:(a.yod rex ['-' rex]))
1514− ['~' (a-co y.yod)]
1515− ::
1516− %r
1517− =+ yug=(yell q.p.lot)
1518− => ^+(. .(rex ?~(f.yug rex ['.' (s-co f.yug)])))
1519− :- '~'
1520− ?: &(=(0 d.yug) =(0 m.yug) =(0 h.yug) =(0 s.yug))
1521− ['.' 's' '0' rex]
1522− => ^+(. ?:(=(0 s.yug) . .(rex ['.' 's' (a-co s.yug)])))
1523− => ^+(. ?:(=(0 m.yug) . .(rex ['.' 'm' (a-co m.yug)])))
1524− => ^+(. ?:(=(0 h.yug) . .(rex ['.' 'h' (a-co h.yug)])))
1525− => ^+(. ?:(=(0 d.yug) . .(rex ['.' 'd' (a-co d.yug)])))
1526− +.rex
1527− ==
1528− ::
1529− %f
1530− ?: =(& q.p.lot)
1531− ['.' 'y' rex]
1532− ?:(=(| q.p.lot) ['.' 'n' rex] (z-co q.p.lot))
1533− ::
1534− %n ['~' rex]
1535− %i
1536− ?+ hay (z-co q.p.lot)
1537− %f ((ro-co [3 10 4] |=(a=@ ~(d ne a))) q.p.lot)
1538− %s ((ro-co [4 16 8] |=(a=@ ~(x ne a))) q.p.lot)
1539− ==
1540− ::
1541− %p
1542− =+ dyx=(met 3 q.p.lot)
1543− :- '~'
1544− ?: (lte dyx 1)
1545− (weld (trip (tod:po q.p.lot)) rex)
1546− ?: =(2 dyx)
1547− ;: weld
1548− (trip (tos:po (end 3 1 q.p.lot)))
1549− (trip (tod:po (rsh 3 1 q.p.lot)))
1550− rex
1551− ==
1552− =+ [dyz=(met 5 q.p.lot) fin=|]
1553− |- ^- tape
1554− ?: =(0 dyz)
1555− rex
1556− %= $
1557− fin &
1558− dyz (dec dyz)
1559− q.p.lot (rsh 5 1 q.p.lot)
1560− rex
1561− =+ syb=(wren:un (end 5 1 q.p.lot))
1562− =+ cog=~(zig mu [(rsh 4 1 syb) (end 4 1 syb)])
1563− ;: weld
1564− (trip (tos:po (end 3 1 p.cog)))
1565− (trip (tod:po (rsh 3 1 p.cog)))
1566− `tape`['-' ~]
1567− (trip (tos:po (end 3 1 q.cog)))
1568− (trip (tod:po (rsh 3 1 q.cog)))
1569− `tape`?:(fin ['-' ?:(=(1 (end 0 1 dyz)) ~ ['-' ~])] ~)
1570− rex
1571− ==
1572− ==
1573− ::
1574− %r
1575− ?+ hay (z-co q.p.lot)
1576− %d
1577− =+ r=(rlyd q.p.lot)
1578− ?~ e.r
1579− ['.' '~' (r-co r)]
1580− ['.' '~' u.e.r]
1581− %h ['.' '~' '~' (r-co (rlyh q.p.lot))]
1582− %q ['.' '~' '~' '~' (r-co (rlyq q.p.lot))]
1583− %s ['.' (r-co (rlys q.p.lot))]
1584− ==
1585− ::
1586− %u
1587− =- (weld p.gam ?:(=(0 q.p.lot) `tape`['0' ~] q.gam))
1588− ^= gam ^- [p=tape q=tape]
1589− ?+ hay [~ ((ox-co [10 3] |=(a=@ ~(d ne a))) q.p.lot)]
1590− %b [['0' 'b' ~] ((ox-co [2 4] |=(a=@ ~(d ne a))) q.p.lot)]
1591− %i [['0' 'i' ~] ((d-co 1) q.p.lot)]
1592− %x [['0' 'x' ~] ((ox-co [16 4] |=(a=@ ~(x ne a))) q.p.lot)]
1593− %v [['0' 'v' ~] ((ox-co [32 5] |=(a=@ ~(x ne a))) q.p.lot)]
1594− %w [['0' 'w' ~] ((ox-co [64 5] |=(a=@ ~(w ne a))) q.p.lot)]
1595− ==
1596− ::
1597− %s
1598− %+ weld
1599− ?:((syn:si q.p.lot) "--" "-")
1600− $(yed 'u', q.p.lot (abs:si q.p.lot))
1601− ::
1602− %t
1603− ?: =('a' hay)
1604− ?: =('s' (cut 3 [2 1] p.p.lot))
1605−
1606− (weld (rip 3 q.p.lot) rex)
1607− ['~' '.' (weld (rip 3 q.p.lot) rex)]
1608− ['~' '~' (weld (rip 3 (wood q.p.lot)) rex)]
1609− ==
1610− --
1611− =+ rex=*tape
1612− =< |%
1613− ++ a-co |=(dat=@ ((d-co 1) dat))
1614− ++ d-co |=(min=@ (em-co [10 min] |=([? b=@ c=tape] [~(d ne b) c])))
1615− ++ r-co
1616− |= [syn=? nub=@ der=@ ign=(unit tape) ne=?]
1617− => .(rex ['.' (t-co ((d-co 1) der) ne)])
1618− => .(rex ((d-co 1) nub))
1619− ?:(syn rex ['-' rex])
1620− ++ t-co |= [a=tape n=?] ^- tape
1621− ?: n a
1622− ?~ a ~|(%empty-frac !!) t.a
1623− ::
1624− ++ s-co
1625− |= esc=(list ,@) ^- tape
1626− ~| [%so-co esc]
1627− ?~ esc
1628− rex
1629− :- '.'
1630− =>(.(rex $(esc t.esc)) ((x-co 4) i.esc))
1631−
1632− ::
1633− ++ v-co |=(min=@ (em-co [32 min] |=([? b=@ c=tape] [~(v ne b) c])))
1634− ++ w-co |=(min=@ (em-co [64 min] |=([? b=@ c=tape] [~(w ne b) c])))
1635− ++ x-co |=(min=@ (em-co [16 min] |=([? b=@ c=tape] [~(x ne b) c])))
1636− ++ y-co |=(dat=@ ((d-co 2) dat))
1637− ++ z-co |=(dat=@ `tape`['0' 'x' ((x-co 1) dat)])
1638− --
1639− ~% %co +> ~
1640− |%
1641− ++ em-co
1642− ~/ %emco
1643− |= [[bas=@ min=@] [par=$+([? @ tape] tape)]]
1644− |= hol=@
1645− ^- tape
1646− ?: &(=(0 hol) =(0 min))
1647− rex
1648− =+ [rad=(mod hol bas) dar=(div hol bas)]
1649− %= $
1650− min ?:(=(0 min) 0 (dec min))
1651− hol dar
1652− rex (par =(0 dar) rad rex)
1653− ==
1654− ::
1655− ++ ox-co
1656− ~/ %oxco
1657− |= [[bas=@ gop=@] dug=$+(@ @)]
1658− %+ em-co
1659− [|-(?:(=(0 gop) 1 (mul bas $(gop (dec gop))))) 0]
1660− |= [top=? seg=@ res=tape]
1661− %+ weld
1662− ?:(top ~ `tape`['.' ~])
1663− %. seg
1664− %+ em-co(rex res)
1665− [bas ?:(top 0 gop)]
1666− |=([? b=@ c=tape] [(dug b) c])
1667− ::
1668− ++ ro-co
1669− ~/ %roco
1670− |= [[buz=@ bas=@ dop=@] dug=$+(@ @)]
1671− |= hol=@
1672− ^- tape
1673− ?: =(0 dop)
1674− rex
1675− => .(rex $(dop (dec dop)))
1676− :- '.'
1677− %- (em-co [bas 1] |=([? b=@ c=tape] [(dug b) c]))
1678− [(cut buz [(dec dop) 1] hol)]
1679− --
1680− ::
1681−
1682−Examples
1683−--------
1684−
1685− ~zod/try=> ~(rend co ~ %ux 200)
1686− "0xc8"
1687− ~zod/try=> ~(rend co %many ~[[%$ ux/200] [%$ p/40]])
1688− "._0xc8_~~tem__"
1689− ~zod/try=> ~(rend co ~ %p 32.819)
1690− "~pillyt"
1691− ~zod/try=> ~(rend co ~ %ux 18)
1692− "0x12"
1693− ~zod/try=> ~(rend co [~ p=[p=%if q=0x7f00.0001]])
1694− ".127.0.0.1"
1695− ~zod/try=> `@ux`.127.0.0.1
1696− 2.130.706.433
1697− ~zod/try=> ~(rend co %many ~[[~ %ud 20] [~ %uw 133] [~ %tas 'sam']])
1698− "._20_0w25_sam__"
1699− ~zod/try=> ~(rend co %blob [1 1])
1700− "~0ph"
1701− ~zod/try=> ~0ph
1702− [1 1]
1703− ~zod/try=> `@uv`(jam [1 1])
1704− 0vph
1705−
1706−------------------------------------------------------------------------
1707−
1708−### `++ne`
1709−
1710−Digit rendering engine
1711−
1712−A [door]() containing arms that render digits at bases 10, 16, 32, and
1713−64.
1714−
1715−Accepts
1716−-------
1717−
1718−Produces
1719−--------
1720−
1721−`tig` is an [`atom`]().
1722−
1723−Source
1724−------
1725−
1726− ++ ne
1727− |_ tig=@
1728−
1729−Examples
1730−--------
1731−
1732− ~zod/try=> ~(. ne 20)
1733− <4.gut [@ud <414.hhh 100.xkc 1.ypj %164>]>
1734−
1735−------------------------------------------------------------------------
1736−
1737−### `++d`
1738−
1739−Render decimal
1740−
1741−Renders a decimal digit as an atom of an ACII byte value.
1742−
1743−Accepts
1744−-------
1745−
1746−Produces
1747−--------
1748−
1749−`tig` is an [`atom`]().
1750−
1751−Source
1752−------
1753−
1754− ++ d (add tig '0')
1755−
1756−Examples
1757−--------
1758−
1759− ~zod/try=> `@t`~(d ne 7)
1760− '7'
1761−
1762−------------------------------------------------------------------------
1763−
1764−### `++x`
1765−
1766−Render hex
1767−
1768−Renders a hexadecimal digit as an atom of an ASCII byte value.
1769−
1770−Accepts
1771−-------
1772−
1773−Produces
1774−--------
1775−
1776−`tig` is an [`atom`]().
1777−
1778−Source
1779−------
1780−
1781− ++ x ?:((gte tig 10) (add tig 87) d)
1782−
1783−Examples
1784−--------
1785−
1786− ~zod/try=> `@t`~(x ne 7)
1787− '7'
1788− ~zod/try=> `@t`~(x ne 14)
1789− 'e'
1790−
1791−------------------------------------------------------------------------
1792−
1793−### `++v`
1794−
1795−Render base-32
1796−
1797−Renders a base-32 digit as an atom of an ASCII byte value.
1798−
1799−Accepts
1800−-------
1801−
1802−Produces
1803−--------
1804−
1805−Source
1806−------
1807−
1808− ++ v ?:((gte tig 10) (add tig 87) d)
1809−
1810−Examples
1811−--------
1812−
1813− ~zod/try=> `@t`~(v ne 7)
1814− '7'
1815− ~zod/try=> `@t`~(v ne 14)
1816− 'e'
1817− ~zod/try=> `@t`~(v ne 25)
1818− 'p'
1819−
1820−------------------------------------------------------------------------
1821−
1822−### `++w`
1823−
1824−Render base-64
1825−
1826−Renders a base-64 digit as an atom of an ASCII byte value.
1827−
1828−Accepts
1829−-------
1830−
1831−Produces
1832−--------
1833−
1834−`tig` is an [`atom`]().
1835−
1836−Source
1837−------
1838−
1839− ++ w ?:(=(tig 63) '~' ?:(=(tig 62) '-' ?:((gte tig 36) (add tig 29) x)))
1840− --
1841− ::
1842−
1843−Examples
1844−--------
1845−
1846− ~zod/try=> `@t`~(w ne 7)
1847− '7'
1848− ~zod/try=> `@t`~(w ne 14)
1849− 'e'
1850− ~zod/try=> `@t`~(w ne 25)
1851− 'p'
1852− ~zod/try=> `@t`~(w ne 52)
1853− 'Q'
1854− ~zod/try=> `@t`~(w ne 61)
1855− 'Z'
1856− ~zod/try=> `@t`~(w ne 63)
1857− '~'
1858− ~zod/try=> `@t`~(w ne 62)
1859− '-'
1860−
1861−------------------------------------------------------------------------
1862−
1863−### `++mu`
1864−
1865−Core used to scramble 16-bit atoms
1866−
1867−A [door]() that contains arms that are used to scramble two atoms, `top`
1868−and `bot`. Used especially in the phonetic base to disguise the
1869−relationship between a destroyer and its cruiser.
1870−
1871−Accepts
1872−-------
1873−
1874−Produces
1875−--------
1876−
1877−`bot` is an [atom]().
1878−
1879−`top` is an [atom]().
1880−
1881−Source
1882−------
1883−
1884− ++ mu
1885− |_ [top=@ bot=@]
1886−
1887−Examples
1888−--------
1889−
1890− ~zod/try=> ~(. mu 0x20e5 0x5901)
1891− <3.sjm [[@ux @ux] <414.hhh 100.xkc 1.ypj %164>]>
1892−
1893−------------------------------------------------------------------------
1894−
1895−### `++zag`
1896−
1897−Add bottom into top
1898−
1899−Produces the cell of `top` and `bot` with `top` scrambled to the result
1900−of adding `bot` to `top` modulo 16. Used to scramble the name of a
1901−destroyer.
1902−
1903−Accepts
1904−-------
1905−
1906−Produces
1907−--------
1908−
1909−`bot` is an [atom]().
1910−
1911−`top` is an [atom]().
1912−
1913−Source
1914−------
1915−
1916− ++ zag [p=(end 4 1 (add top bot)) q=bot]
1917−
1918−Examples
1919−--------
1920−
1921− ~zod/try=> `[@ux @ux]`~(zag mu 0x20e0 0x201)
1922− [0x22e1 0x201]
1923−
1924−------------------------------------------------------------------------
1925−
1926−### `++zig`
1927−
1928−Subtract bottom from top
1929−
1930−The inverse of [`++zag`](). Produces the cell of `top` and `bot` with
1931−`top` unscrambled. The unscrambled `top` is the sum of the sample `top`
1932−and the 16-bit complement of `bot`. Used to unscramble the name of the
1933−destroyer.
1934−
1935−Accepts
1936−-------
1937−
1938−Produces
1939−--------
1940−
1941−`bot` is an [atom]().
1942−
1943−`top` is an [atom]().
1944−
1945−Source
1946−------
1947−
1948− ++ zig [p=(end 4 1 (add top (sub 0x1.0000 bot))) q=bot]
1949−
1950−Examples
1951−--------
1952−
1953− ~zod/try=> `[@ux @ux]`~(zig mu 0x2f46 0x1042)
1954− [0x1f04 0x1042]
1955−
1956−------------------------------------------------------------------------
1957−
1958−### `++zug`
1959−
1960−Concatenate into atom
1961−
1962−Produces the concatenation of `top` and `bot`. Used to assemble a
1963−destroyer name.
1964−
1965−Accepts
1966−-------
1967−
1968−Produces
1969−--------
1970−
1971−`bot` is an [atom]().
1972−
1973−`top` is an [atom]().
1974−
1975−Source
1976−------
1977−
1978− ++ zug (mix (lsh 4 1 top) bot)
1979−
1980−Examples
1981−--------
1982−
1983− ~zod/try=> `@ux`~(zug mu 0x10e1 0xfa)
1984− 0x10e1.00fa
1985−
1986−------------------------------------------------------------------------
1987−
1988−### `++so`
1989−
1990−Coin parser engine
1991−
1992−Core containing arms that parse [`++coin`]s.
1993−
1994−Accepts
1995−-------
1996−
1997−Produces
1998−--------
1999−
2000−Source
2001−------
2002−
2003− ++ so
2004− |%
2005−
2006−Examples
2007−--------
2008−
2009− ~zod/try=> so
2010− <10.mkn 414.hhh 100.xkc 1.ypj %164>
2011−
2012−------------------------------------------------------------------------
2013−
2014−### `++bisk`
2015−
2016−Parse odor-atom pair
2017−
2018−Parsing rule. Parses an unsigned integer of any permitted base,
2019−producing a [`++dime`]().
2020−
2021−Accepts
2022−-------
2023−
2024−Produces
2025−--------
2026−
2027−Source
2028−------
2029−
2030− ++ bisk
2031− ;~ pose
2032− ;~ pfix (just '0')
2033− ;~ pose
2034− (stag %ub ;~(pfix (just 'b') bay:ag))
2035− (stag %ui ;~(pfix (just 'i') dim:ag))
2036− (stag %ux ;~(pfix (just 'x') hex:ag))
2037− (stag %uv ;~(pfix (just 'v') viz:ag))
2038− (stag %uw ;~(pfix (just 'w') wiz:ag))
2039− ==
2040− ==
2041− (stag %ud dem:ag)
2042− ==
2043−
2044−Examples
2045−--------
2046−
2047− ~zod/try=> (scan "25" bisk:so)
2048− [%ud q=25]
2049− ~zod/try=> (scan "0x12.6401" bisk:so)
2050− [%ux q=1.205.249]
2051−
2052−------------------------------------------------------------------------
2053−
2054−### `++crub`
2055−
2056−Parse `@da`, `@dr`, `@p`, `@t`
2057−
2058−Parsing rule. Parses any atom of any of the following odors after a
2059−leading sig, `~` into a [`++dime`](): [`@da`](), [`@dr`](), [`@p`](),
2060−and [`@t`](), producing a [`++dime`]().
2061−
2062−Accepts
2063−-------
2064−
2065−Produces
2066−--------
2067−
2068−Source
2069−------
2070−
2071− ++ crub
2072− ;~ pose
2073− %+ cook
2074− |=(det=date `dime`[%da (year det)])
2075− ;~ plug
2076− %+ cook
2077− |=([a=@ b=?] [b a])
2078− ;~(plug dim:ag ;~(pose (cold | hep) (easy &)))
2079− ;~(pfix dot dim:ag) :: month
2080− ;~(pfix dot dim:ag) :: day
2081− ;~ pose
2082− ;~ pfix
2083− ;~(plug dot dot)
2084− ;~ plug
2085− dum:ag
2086− ;~(pfix dot dum:ag)
2087− ;~(pfix dot dum:ag)
2088− ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~))
2089− ==
2090− ==
2091− (easy [0 0 0 ~])
2092− ==
2093− ==
2094− ::
2095− %+ cook
2096− |= [a=(list ,[p=?(%d %h %m %s) q=@]) b=(list ,@)]
2097− =+ rop=`tarp`[0 0 0 0 b]
2098− |- ^- dime
2099− ?~ a
2100− [%dr (yule rop)]
2101− ?- p.i.a
2102− %d $(a t.a, d.rop (add q.i.a d.rop))
2103− %h $(a t.a, h.rop (add q.i.a h.rop))
2104− %m $(a t.a, m.rop (add q.i.a m.rop))
2105− %s $(a t.a, s.rop (add q.i.a s.rop))
2106− ==
2107− ;~ plug
2108− %+ most
2109− dot
2110− ;~ pose
2111− ;~(pfix (just 'd') (stag %d dim:ag))
2112− ;~(pfix (just 'h') (stag %h dim:ag))
2113− ;~(pfix (just 'm') (stag %m dim:ag))
2114− ;~(pfix (just 's') (stag %s dim:ag))
2115− ==
2116− ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~))
2117− ==
2118− ::
2119− (stag %p fed:ag)
2120− ;~(pfix dot (stag %ta urs:ab))
2121− ;~(pfix sig (stag %t (cook woad urs:ab)))
2122− ;~(pfix hep (stag %c (cook turf (cook woad urs:ab))))
2123− ==
2124−
2125−Examples
2126−--------
2127−
2128− ~zod/try=> (scan "1926.5.12" crub:so)
2129− [p=~.da q=170.141.184.449.747.016.871.285.095.307.149.312.000]
2130− ~zod/try=> (,[%da @da] (scan "1926.5.12" crub:so))
2131− [%da ~1926.5.12]
2132− ~zod/try=> (scan "s10" crub:so)
2133− [p=~.dr q=184.467.440.737.095.516.160]
2134− ~zod/try=> (,[%dr @dr] (scan "s10" crub:so))
2135− [%dr ~s10]
2136− ~zod/try=> (scan "doznec" crub:so)
2137− [%p 256]
2138− ~zod/try=> (scan ".mas" crub:so)
2139− [%ta 7.561.581]
2140−
2141−------------------------------------------------------------------------
2142−
2143−### `++nuck`
2144−
2145−Top-level coin parser
2146−
2147−Parsing rule. Switches on the first character and applies the
2148−corresponding [`++coin`]() parser.
2149−
2150−Accepts
2151−-------
2152−
2153−Produces
2154−--------
2155−
2156−Source
2157−------
2158−
2159− ++ nuck
2160− %+ knee *coin |. ~+
2161− %- stew
2162− ^. stet ^. limo
2163− :~ :- ['a' 'z'] (cook |=(a=@ta [~ %tas a]) sym)
2164− :- ['0' '9'] (stag ~ bisk)
2165− :- '-' (stag ~ tash)
2166− :- '.' ;~(pfix dot perd)
2167− :- '~' ;~(pfix sig ;~(pose twid (easy [~ %n 0])))
2168− ==
2169−
2170−Examples
2171−--------
2172−
2173− ~zod/try=> (scan "~pillyt" nuck:so)
2174− [% p=[p=~.p q=32.819]]
2175− ~zod/try=> (scan "0x12" nuck:so)
2176− [% p=[p=~.ux q=18]]
2177− ~zod/try=> (scan ".127.0.0.1" nuck:so)
2178− [% p=[p=~.if q=2.130.706.433]]
2179− ~zod/try=> `@ud`.127.0.0.1
2180− 2.130.706.433
2181− ~zod/try=> (scan "._20_0w25_sam__" nuck:so)
2182− [ %many
2183− p
2184− ~[[% p=[p=~.ud q=20]] [% p=[p=~.uw q=133]] [% p=[p=~.tas q=7.168.371]]]
2185− ]
2186− ~zod/try=> `@`%sam
2187− 7.168.371
2188− ~zod/try=> (scan "~0ph" nuck:so)
2189− [%blob p=[1 1]]
2190− ~zod/try=> ~0ph
2191− [1 1]
2192− ~zod/try=> `@uv`(jam [1 1])
2193− 0vph
2194−
2195−------------------------------------------------------------------------
2196−
2197−### `++nusk`
2198−
2199−Parse coin literal with escapes
2200−
2201−Parsing rule. Parses a coin literal with escapes. (See also: xx tuple
2202−formatting).
2203−
2204−Accepts
2205−-------
2206−
2207−Produces
2208−--------
2209−
2210−Source
2211−------
2212−
2213− ++ nusk
2214− (sear |=(a=@ta (rush (wick a) nuck)) urt:ab)
2215−
2216−Examples
2217−--------
2218−
2219− ~zod/try=> ~.asd_a
2220− ~.asd_a
2221− ~zod/try=> ._1_~~.asd~-a__
2222− [1 ~.asd_a]
2223− ~zod/try=> (scan "~~.asd~-a" nusk:so)
2224− [% p=[p=~.ta q=418.212.246.369]]
2225− ~zod/try=> (,[~ %ta @ta] (scan "~~.asd~-a" nusk:so))
2226− [~ %ta ~.asd_a]
2227−
2228−------------------------------------------------------------------------
2229−
2230−### `++perd`
2231−
2232−Parsing rule.
2233−
2234−Parsing rule. Parses a dime or tuple without their respective standard
2235−prefixes.
2236−
2237−Accepts
2238−-------
2239−
2240−Produces
2241−--------
2242−
2243−Source
2244−------
2245−
2246− ++ perd
2247− ;~ pose
2248− (stag ~ zust)
2249− (stag %many (ifix [cab ;~(plug cab cab)] (more cab nusk)))
2250− ==
2251−
2252−Examples
2253−--------
2254−
2255− ~zod/try=> (scan "y" perd:so)
2256− [~ [%f %.y]]
2257− ~zod/try=> (scan "n" perd:so)
2258− [~ [%f %.n]]
2259− ~zod/try=> |
2260− %.n
2261− ~zod/try=> (scan "_20_x__" perd:so)
2262− [%many [[% p=[p=~.ud q=20]] ~[[% p=[p=~.tas q=120]]]]]
2263−
2264−------------------------------------------------------------------------
2265−
2266−### `++royl`
2267−
2268−Parse dime float
2269−
2270−Parsing rule. Parses a number into a [`++dime`]() float.
2271−
2272−Accepts
2273−-------
2274−
2275−Produces
2276−--------
2277−
2278−Source
2279−------
2280−
2281− ++ royl
2282− =+ ^= zer
2283− (cook lent (star (just '0')))
2284− =+ ^= voy
2285− %+ cook royl-cell
2286− ;~ plug
2287− ;~(pose (cold | hep) (easy &))
2288− ;~(plug dim:ag ;~(pose ;~(pfix dot ;~(plug zer dim:ag)) (easy [0 0])))
2289− ;~ pose
2290− ;~ pfix
2291− (just 'e')
2292− (cook some ;~(plug ;~(pose (cold | hep) (easy &)) dim:ag))
2293− ==
2294− (easy ~)
2295− ==
2296− ==
2297− ;~ pose
2298− (stag %rh (cook rylh ;~(pfix ;~(plug sig sig) voy)))
2299− (stag %rq (cook rylq ;~(pfix ;~(plug sig sig sig) voy)))
2300− (stag %rd (cook ryld ;~(pfix sig voy)))
2301− (stag %rs (cook ryls voy)
2302− ==
2303−
2304−Examples
2305−--------
2306−
2307− ~zod/try=> (scan "~3.14" royl:so)
2308− [%rd .~3.13999999999999]
2309− ~zod/try=> .~3.14
2310− .~3.13999999999999
2311−
2312------------------------------------------------------------------------
4------------------------------------------------------------------------
2313
5
2314−### `++royl-cell`
2315−
2316−XX still not fully functional
2317−
2318−Intermediate parsed float convereter
2319−
2320------------------------------------------------------------------------
6------------------------------------------------------------------------
2321
7
2322−### `++tash`
2323−
2324−Parse signed dime
2325−
2326−Accepts
2327−-------
2328−
2329−Accepts
2330−-------
2331−
2332−Produces
2333−--------
2334−
2335−Produces
2336−--------
2337−
2338−Parsing rule. Parses a signed number into a [`++dime`]().
2339−
2340−Source
2341−------
2342−
2343− ++ royl-cell
2344− |= [a=? b=[c=@ d=@ e=@] f=(unit ,[h=? i=@])]
2345− ^- [? @ @ @ (unit ,@s)]
2346− ?~ f
2347− [a c.b d.b e.b ~]
2348− ?: h.u.f
2349− [a c.b d.b e.b [~ (mul i.u.f 2)]]
2350− [a c.b d.b e.b [~ (dec (mul i.u.f 2))]]
2351−
2352−Examples
2353−--------
2354−
2355−Source
2356−------
2357−
2358− ++ tash
2359− =+ ^= neg
2360− |= [syn=? mol=dime] ^- dime
2361− ?> =('u' (end 3 1 p.mol))
2362− [(cat 3 's' (rsh 3 1 p.mol)) (new:si syn q.mol)]
2363− ;~ pfix hep
2364− ;~ pose
2365− (cook |=(a=dime (neg | a)) bisk)
2366− ;~(pfix hep (cook |=(a=dime (neg & a)) bisk))
2367− ==
2368− ==
2369−
2370−Examples
2371−--------
2372−
2373− ~zod/try=> (scan "-20" tash:so)
2374− [p=~.sd q=39]
2375− ~zod/try=> (,[%sd @sd] (scan "-20" tash:so))
2376− [%sd -20]
2377− ~zod/try=> (,[%sd @sd] (scan "--20" tash:so))
2378− [%sd --20]
2379− ~zod/try=> (,[%sx @sx] (scan "--0x2e" tash:so))
2380− [%sx --0x2e]
2381−
2382------------------------------------------------------------------------
8------------------------------------------------------------------------
2383
9
2384−### `++twid`
2385−
2386−Parse coins without `~` prefix
2387−
2388−Parsing rule. Parses coins after a leading sig, `~`.
2389−
2390−Accepts
2391−-------
2392−
2393−Produces
2394−--------
2395−
2396−Source
2397−------
2398−
2399− ++ twid
2400− ;~ pose
2401− (cook |=(a=@ [%blob (cue a)]) ;~(pfix (just '0') vum:ag))
2402− (stag ~ crub)
2403− ==
2404− ::
2405−
2406−Examples
2407−--------
2408−
2409− ~zod/try=> (scan "zod" twid:so)
2410− [~ [%p 0]]
2411− ~zod/try=> (scan ".sam" twid:so)
2412− [~ [%ta 7.168.371]]
2413− ~zod/try=> `@ud`~.sam
2414− 7.168.371
2415− ~zod/try=> `@t`~.sam
2416− 'sam'
2417− ~zod/try=> (scan "0ph" twid:so)
2418− [%blob [1 1]]
2419−
2420------------------------------------------------------------------------
10------------------------------------------------------------------------
2421
11
2422−### `++zust`
2423−
2424−Parse prefixed dimes from `@if`, `@f`, `@rd`
2425−
2426−Parsing rule. Parses an atom of either [`@if`]() (IP address), [`@f`]()
2427−(loobean), or [`rf`]()(floating point) into a [`++dime`]().
2428−
2429−Accepts
2430−-------
2431−
2432−Produces
2433−--------
2434−
2435−Source
2436−------
2437−
2438− ++ zust
2439− ;~ pose
2440− (stag %is bip:ag)
2441− (stag %if lip:ag)
2442− (stag %f ;~(pose (cold & (just 'y')) (cold | (just 'n'))))
2443− royl
2444− ==
2445− --
2446−
2447−Examples
2448−--------
2449−
2450− ~zod/try=> (scan "127.0.0.1" zust:so)
2451− [%if q=2.130.706.433]
2452− ~zod/try=> (scan "af.0.0.0.0.e7a5.30d2.7" zust:so)
2453− [%is q=908.651.950.243.594.834.993.091.554.288.205.831]
2454− ~zod/try=> (,[%is @is] (scan "af.0.0.0.0.e7a5.30d2.7" zust:so))
2455− [%is .af.0.0.0.0.e7a5.30d2.7]
2456− ~zod/try=> (,[%is @ux] (scan "af.0.0.0.0.e7a5.30d2.7" zust:so))
2457− [%is 0xaf.0000.0000.0000.0000.e7a5.30d2.0007]
2458− ~zod/try=> (scan "y" zust:so)
2459− [%f %.y]
2460− ~zod/try=> (scan "12.09" zust:so)
2461− [%rd .~12.00999999999999]
2462−
2463------------------------------------------------------------------------
12------------------------------------------------------------------------
2464
13
2465−### `++scot`
2466−
2467−Render dime as cord
2468−
2469−Renders a dime `mol` as a cord.
2470−
2471−Accepts
2472−-------
2473−
2474−Produces
2475−--------
2476−
2477−`mol` is a [`++dime`]().
2478−
2479−Source
2480−------
2481−
2482− ++ scot |=(mol=dime ~(rent co %$ mol))
2483−
2484−Examples
2485−--------
2486−
2487− ~zod/try=> (scot %p ~pillyt)
2488− ~.~pillyt
2489− ~zod/try=> `@t`(scot %p ~pillyt)
2490− '~pillyt'
2491− ~zod/try=> (scot %ux 0x12)
2492− ~.0x12
2493− ~zod/try=> `@t`(scot %ux 0x12)
2494− '0x12'
2495− ~zod/try=> (scot %if .127.0.0.1)
2496− ~..127.0.0.1
2497− ~zod/try=> `@t`(scot %if .127.0.0.1)
2498− '.127.0.0.1'
2499− ~zod/try=> (scot %ta ~.asd_a)
2500− ~.~.asd_a
2501− ~zod/try=> `@t`(scot %ta ~.asd_a)
2502− '~.asd_a'
2503−
2504------------------------------------------------------------------------
14------------------------------------------------------------------------
2505
15
2506−### `++scow`
2507−
2508−Render dime as tape
2509−
2510−Renders `mol` as a tape.
2511−
2512−Accepts
2513−-------
2514−
2515−Produces
2516−--------
2517−
2518−`mol` is a [`++dime`]().
2519−
2520−Source
2521−------
2522−
2523− ++ scow |=(mol=dime ~(rend co %$ mol))
2524−
2525−Examples
2526−--------
2527−
2528− ~zod/try=> (scow %p ~pillyt)
2529− "~pillyt"
2530− ~zod/try=> (scow %ux 0x12)
2531− "0x12"
2532− ~zod/try=> (scow %if .127.0.0.1)
2533− ".127.0.0.1"
2534− ~zod/try=> (scow %ta ~.asd_a)
2535− "~.asd_a"
2536−
2537------------------------------------------------------------------------
16------------------------------------------------------------------------
2538
17
2539−### `++slat`
2540−
2541−Curried slaw
2542−
2543−Produces a [`gate`]() that parses a [`term`]() `txt` to an atom of the
2544−odor specified by `mod`.
2545−
2546−Accepts
2547−-------
2548−
2549−Produces
2550−--------
2551−
2552−`mod` is a term, an atom of odor [`@tas`]().
2553−
2554−`txt` is a span, an atom of odor [`@ta`]().
2555−
2556−Source
2557−------
2558−
2559− ++ slat |=(mod=@tas |=(txt=@ta (slaw mod txt)))
2560−
2561−Examples
2562−--------
2563−
2564− ~zod/try=> `(unit ,@p)`((slat %p) '~pillyt')
2565− [~ ~pillyt]
2566− ~zod/try=> `(unit ,@ux)`((slat %ux) '0x12')
2567− [~ 0x12]
2568− ~zod/try=> `(unit ,@if)`((slat %if) '.127.0.0.1')
2569− [~ .127.0.0.1]
2570− ~zod/try=> `(unit ,@ta)`((slat %ta) '~.asd_a')
2571− [~ ~.asd_a
2572−
2573------------------------------------------------------------------------
18------------------------------------------------------------------------
2574
19
2575−### `++slav`
2576−
2577−Demand: parse span with input odor
2578−
2579−Parses a span `txt` to an atom of the odor specificed by `mod`. Crashes
2580−if it failes to parse.
2581−
2582−Accepts
2583−-------
2584−
2585−Produces
2586−--------
2587−
2588−`mod` is a term, an atom of odor [`@tas`]().
2589−
2590−`txt` is a span, an atom of odor [`@ta`]().
2591−
2592−Source
2593−------
2594−
2595− ++ slav |=([mod=@tas txt=@ta] (need (slaw mod txt)))
2596−
2597−Examples
2598−--------
2599−
2600− ~zod/try=> `@p`(slav %p '~pillyt')
2601− ~pillyt
2602− ~zod/try=> `@p`(slav %p '~pillam')
2603− ! exit
2604− ~zod/try=> `@ux`(slav %ux '0x12')
2605− 0x12
2606− ~zod/try=> `@ux`(slav %ux '0b10')
2607− ! exit
2608− ~zod/try=> `@if`(slav %if '.127.0.0.1')
2609− .127.0.0.1
2610− ~zod/try=> `@if`(slav %if '.fe80.0.0.202')
2611− ! exit
2612− ~zod/try=> `@ta`(slav %ta '~.asd_a')
2613− ~.asd_a
2614− ~zod/try=> `@ta`(slav %ta '~~asd-a')
2615− ! exit
2616−
2617------------------------------------------------------------------------
20------------------------------------------------------------------------
2618
21
2619−### `++slaw`
2620−
2621−Parse span to input odor
2622−
2623−Parses a span `txt` to an atom of the odor specified by `mod`.
2624−
2625−Accepts
2626−-------
2627−
2628−Produces
2629−--------
2630−
2631−`mod` is a term, an atom of odor [`@tas`]().
2632−
2633−`txt` is a span, an atom of odor [`@ta`]().
2634−
2635−Source
2636−------
2637−
2638− ++ slaw
2639− |= [mod=@tas txt=@ta]
2640− ^- (unit ,@)
2641− =+ con=(slay txt)
2642− ?.(&(?=([~ %$ @ @] con) =(p.p.u.con mod)) ~ [~ q.p.u.con])
2643− ::
2644−
2645−Examples
2646−--------
2647−
2648− ~zod/try=> `(unit ,@p)`(slaw %p '~pillyt')
2649− [~ ~pillyt]
2650− ~zod/try=> `(unit ,@p)`(slaw %p '~pillam')
2651− ~
2652− ~zod/try=> `(unit ,@ux)`(slaw %ux '0x12')
2653− [~ 0x12]
2654− ~zod/try=> `(unit ,@ux)`(slaw %ux '0b10')
2655− ~
2656− ~zod/try=> `(unit ,@if)`(slaw %if '.127.0.0.1')
2657− [~ .127.0.0.1]
2658− ~zod/try=> `(unit ,@if)`(slaw %if '.fe80.0.0.202')
2659− ~
2660− ~zod/try=> `(unit ,@ta)`(slaw %ta '~.asd_a')
2661− [~ ~.asd_a]
2662− ~zod/try=> `(unit ,@ta)`(slaw %ta '~~asd-a')
2663− ~
2664−
2665------------------------------------------------------------------------
22------------------------------------------------------------------------
2666
23
2667−### `++slay`
2668−
2669−Parse span to coin
2670−
2671−Parses a span `txt` to the unit of a [`++coin`]().
2672−
2673−Accepts
2674−-------
2675−
2676−Produces
2677−--------
2678−
2679−`txt` is a [`@ta`]().
2680−
2681−Source
2682−------
2683−
2684− ++ slay
2685− |= txt=@ta ^- (unit coin)
2686− =+ vex=((full nuck:so) [[1 1] (trip txt)])
2687− ?~ q.vex
2688− ~
2689− [~ p.u.q.vex]
2690− ::
2691−
2692−Examples
2693−--------
2694−
2695− ~zod/try=> (slay '~pillyt')
2696− [~ [% p=[p=~.p q=32.819]]]
2697− ~zod/try=> (slay '0x12')
2698− [~ [% p=[p=~.ux q=18]]]
2699− ~zod/try=> (slay '.127.0.0.1')
2700− [~ [% p=[p=~.if q=2.130.706.433]]]
2701− ~zod/try=> `@ud`.127.0.0.1
2702− 2.130.706.433
2703− ~zod/try=> (slay '._20_0w25_sam__')
2704− [ ~
2705− [ %many
2706− p=~[[% p=[p=~.ud q=20]] [% p=[p=~.uw q=133]] [% p=[p=~.tas q=7.168.371]]]
2707− ]
2708− ]
2709− ~zod/try=> `@`%sam
2710− 7.168.371
2711− ~zod/try=> (slay '~0ph')
2712− [~ [%blob p=[1 1]]]
2713− ~zod/try=> 0ph
2714− ~ <syntax error at [1 2]>
2715− ~zod/try=> ~0ph
2716− [1 1]
2717− ~zod/try=> `@uv`(jam [1 1])
2718− 0vph
2719−
2720------------------------------------------------------------------------
24------------------------------------------------------------------------
2721
25
2722------------------------------------------------------------------------
26------------------------------------------------------------------------
2723
27
2724−### `++smyt`
2725−
2726−Render path as tank
2727−
2728−Renders the path `bon` as a [`tank`](), which is used for
2729−pretty-printing.
2730−
2731−Accepts
2732−-------
2733−
2734−Produces
2735−--------
2736−
2737−`bon` is a [`++path`]().
2738−
2739−Source
2740−------
2741−
2742− ++ smyt
2743− |= bon=path ^- tank
2744− :+ %rose [['/' ~] ['/' ~] ['/' ~]]
2745− |- ^- (list tank)
2746− (turn bon |=(a=@ [%leaf (rip 3 a)]))
2747−
2748−Examples
2749−--------
2750−
2751− ~zod/try=> (smyt %)
2752− [ %rose
2753− p=[p="/" q="/" r="/"]
2754− q
2755− ~[ [%leaf p="~zod"]
2756− [%leaf p="try"]
2757− [%leaf p="~2014.10.28..18.36.58..a280"]
2758− ]
2759− ]
2760− ~zod/try=> (smyt /as/les/top)
2761− [ %rose
2762− p=[p="/" q="/" r="/"]
2763− q=~[[%leaf p="as"] [%leaf p="les"] [%leaf p="top"]]
2764− ]
2765−
2766------------------------------------------------------------------------
28------------------------------------------------------------------------
2767
29
2768−### `++spat`
2769−
2770−Render path as cord
2771−
2772−Renders a path `pax` as cord.
2773−
2774−Accepts
2775−-------
2776−
2777−Produces
2778−--------
2779−
2780−`pax` is a [`path`]().
2781−
2782−Source
2783−------
2784−
2785− ++ spat |=(pax=path (crip (spud pax))) :: path to cord
2786−
2787−Examples
2788−--------
2789−
2790− ~zod/try=> (spat %)
2791− '~zod/try/~2014.10.28..18.40.20..4287'
2792− ~zod/try=> (spat %/bin)
2793− '~zod/try/~2014.10.28..18.41.12..3bcd/bin'
2794− ~zod/try=> (spat /as/les/top)
2795− '/as/les/top'
2796−
2797------------------------------------------------------------------------
30------------------------------------------------------------------------
2798
31
2799−### `++spud`
2800−
2801−Render path as tape
2802−
2803−Renders a path `pax` as [tape]().
2804−
2805−Accepts
2806−-------
2807−
2808−Produces
2809−--------
2810−
2811−`pax` is a [`path`]().
2812−
2813−Source
2814−------
2815−
2816− ++ spud |=(pax=path ~(ram re (smyt pax))) :: path to tape
2817−
2818−Examples
2819−--------
2820−
2821− ~zod/try=> (spud %)
2822− "~zod/try/~2014.10.28..18.40.46..e951"
2823− ~zod/try=> (spud %/bin)
2824− "~zod/try/~2014.10.28..18.41.05..16f2/bin"
2825− ~zod/try=> (spud /as/les/top)
2826− "/as/les/top"
2827−
2828------------------------------------------------------------------------
32------------------------------------------------------------------------
2829
33
2830−### `++stab`
2831−
2832−Parse span to path
2833−
2834−Parsing rule. Parses a span `zep` to a static [`++path`](/doc/hoon/library/1#++path).
2835−
2836−Accepts
2837−-------
2838−
2839−Produces
2840−--------
2841−
2842−Source
2843−------
2844−
2845− ++ stab :: parse span to path
2846− |= zep=@ta ^- path
2847− (rash zep ;~(pfix fas ;~(sfix (more fas urs:ab) fas)))
2848−
2849−Examples
2850−--------
2851−
2852− ~zod/try=> (stab '/as/lek/tor')
2853− /as/lek/tor
2854− ~zod/try=> `(pole ,@ta)`(stab '/as/lek/tor')
2855− [~.as [~.lek [~.tor ~]]]
2856− ~zod/try=> (stab '~zod/arvo/~2014.10.28..18.48.41..335f/zuse')
2857− ~zod/arvo/~2014.10.28..18.48.41..335f/zuse
2858− ~zod/try=> `(pole ,@ta)`(stab '~zod/arvo/~2014.10.28..18.48.41..335f/zuse')
2859− [~.~zod [~.arvo [~.~2014.10.28..18.48.41..335f [~.zuse ~]]]]
2860− ~zod/try=> (stab '/a/~pillyt/pals/1')
2861− /a/~pillyt/pals/1
2862− ~zod/try=> `(pole ,@ta)`(stab '/a/~pillyt/pals/1')
2863− [~.a [~.~pillyt [~.pals [~.1 ~]]]]
docs/system/hoon/library/2em.md−758
@@ -1,758 +0,0 @@
1−2eM regular-expressions
2−=======================
3−
4−### `++pars`
5−
6− ++ pars
7− |= [a=tape] :: parse tape to rege
8− ^- (unit rege)
9− =+ foo=((full apex:rags) [[1 1] a])
10− ?~ q.foo
11− ~
12− [~ p.u.q.foo]
13− ::
14−
15−Parse regular expression
16−
17− ~zod/try=> (pars "samo")
18− [ ~
19− [ %pair
20− p=[%lite p=~~s]
21− q=[%pair p=[%lite p=~~a] q=[%pair p=[%lite p=~~m] q=[%lite p=~~o]]]
22− ]
23− ]
24− ~zod/try=> (pars "so[,.0-9]")
25− [ ~
26− [ %pair
27− p=[%lite p=~~s]
28− q=[%pair p=[%lite p=~~o] q=[%brac p=288.036.862.105.223.168]]
29− ]
30− ]
31− ~zod/try=> `@ub`288.036.862.105.223.168
32− 0b11.1111.1111.0101.0000.0000.0000.0000.0000.0000.0000.0000.0000.0000.0000
33− ~zod/try=> `@ub`(lsh 0 `@`'9' 1)
34− 0b10.0000.0000.0000.0000.0000.0000.0000.0000.0000.0000.0000.0000.0000.0000
35− ~zod/try=> `@ub`(roll (turn ",.0123456789" |=(a=@ (lsh 0 a 1))) con)
36− 0b11.1111.1111.0101.0000.0000.0000.0000.0000.0000.0000.0000.0000.0000.0000
37− ~zod/try=> (pars "sop.*")
38− [ ~
39− [ %pair
40− p=[%lite p=~~s]
41− q=[%pair p=[%lite p=~~o] q=[%pair p=[%lite p=~~p] q=[%mant p=%dote]]]
42− ]
43− ]
44− ~zod/try=> (pars "(hel)?")
45− [ ~
46− [ %eith
47− p
48− [ %capt
49− p=[%pair p=[%lite p=~~h] q=[%pair p=[%lite p=~~e] q=[%lite p=~~l]]]
50− q=0
51− ]
52− q=%empt
53− ]
54− ]
55− ~zod/try=> (pars "(hel)??")
56− [ ~
57− [ %eith
58− p=%empt
59− q
60− [ %capt
61− p=[%pair p=[%lite p=~~h] q=[%pair p=[%lite p=~~e] q=[%lite p=~~l]]]
62− q=0
63− ]
64− ]
65− ]
66− ~zod/try=> (pars "a\{1,20}")
67− [~ [%betw p=[%lite p=~~a] q=1 r=20]]
68−
69−### `++rags`
70−
71− ++ rags :: rege parsers
72− => |%
73−
74−Regex parser arms
75−
76−### `++nor`
77−
78− ++ nor ;~(less (mask "^$()|*?+.[\\") (shim 1 127)) :: non-control char
79−
80−XX document
81−
82−### `++les`
83−
84− ++ les ;~(less bas asp) :: not backslash
85−
86−XX document
87−
88−### `++lep`
89−
90− ++ lep ;~(less (mask "^[]\\") asp) :: charset non-control
91−
92−XX document
93−
94−### `++asp`
95−
96− ++ asp (shim 32 126) :: printable ascii
97−
98−XX document
99−
100−### `++alb`
101−
102− ++ alb ;~(less ser asp) :: charset literal char
103−
104−XX document
105−
106−### `++mis`
107−
108− ++ mis ;~(less aln asp) :: non alphanumeric
109− --
110− |%
111−
112−XX document
113−
114−### `++apex`
115−
116− ++ apex :: top level
117− %+ knee *rege |. ~+
118− ;~ pose
119− ;~((bend |=(a=[rege rege] (some [%eith a]))) mall ;~(pfix bar apex))
120− (stag %eith ;~(plug (easy %empt) ;~(pfix bar apex)))
121− (easy %empt)
122− ==
123− ::
124−
125−XX document
126−
127−### `++mall`
128−
129− ++ mall
130− %+ knee *rege |. ~+
131− ;~((bend |=(a=[rege rege] (some [%pair a]))) bets mall)
132− ::
133−
134−XX document
135−
136−### `++bets`
137−
138− ++ bets
139− %+ knee *rege |. ~+
140− |= tub=nail
141− =+ vex=(chun tub)
142− ?~ q.vex
143− vex
144− =+ a=p.u.q.vex
145− %- ;~ pose
146− (cold [%eith %empt a] (jest '??'))
147− (cold [%manl a] (jest '*?'))
148− (cold [%plll a] (jest '+?'))
149− (cold [%eith a %empt] wut)
150− (cold [%mant a] tar)
151− (cold [%plls a] lus)
152− (stag %betl ;~(plug (easy a) ;~(sfix rang wut)))
153− (stag %betw ;~(plug (easy a) rang))
154− (stag %binl ;~(plug (easy a) (ifix [kel (jest ',}?')] dim:ag)))
155− (stag %bant ;~(plug (easy a) (ifix [kel (jest '}?')] dim:ag)))
156− (stag %bant ;~(plug (easy a) (ifix [kel ker] dim:ag)))
157− (stag %bint ;~(plug (easy a) (ifix [kel (jest ',}')] dim:ag)))
158− (easy a)
159− ==
160− q.u.q.vex
161− ::
162−
163−XX document
164−
165−### `++ranc`
166−
167− ++ ranc
168− |= [a=@ b=@]
169− ^- @
170− ?:((gth a b) 0 (con (bex a) $(a +(a))))
171− ::
172−
173−XX document
174−
175−### `++flap`
176−
177− ++ flap |=(a=@ (mix a (dec (bex 256))))
178− ::
179−
180−XX document
181−
182−### `++rang`
183−
184− ++ rang
185− %+ sear |=([a=@ b=@] ?:((lte a b) (some [a b]) ~))
186− (ifix [kel ker] ;~(plug dim:ag ;~(pfix com dim:ag)))
187− ::
188−
189−XX document
190−
191−### `++chun`
192−
193− ++ chun
194− %+ knee *rege |. ~+
195− ;~ pose
196− (cold %ende buc)
197− (cold %sart ket)
198− (cold %dote dot)
199− %+ cook |=(a=(list char) (reel a |=([p=char q=rege] [%pair [%lite p] q])))
200− ;~(pfix (jest '\\Q') cape)
201− |= tub=nail
202− =+ foo=;~(plug kel dim:ag ;~(pose ker (jest ',}') ;~(plug com dim:ag ker)))
203− =+ bar=(foo tub)
204− ?~(q.bar (chad tub) (fail tub))
205− (cook |=([a=rege] [%capt a 0]) (ifix [pel per] apex))
206− %+ cook |=([a=rege] [%capt a 0])
207− (ifix [;~(plug (jest '(?P<') (plus aln) gar) per] apex)
208− (ifix [(jest '(?:') per] apex)
209− (stag %brac ;~(pfix sel seac))
210− ==
211− ::
212−
213−XX document
214−
215−### `++seac`
216−
217− ++ seac
218− |= tub=nail
219− ?~ q.tub
220− (fail tub)
221− ?: =(i.q.tub '^')
222− (;~(pfix ket (cook flap sead)) tub)
223− (sead tub)
224− ::
225−
226−XX document
227−
228−### `++sead`
229−
230− ++ sead
231− %+ knee *@ |. ~+
232− ;~ pose
233− |= tub=nail
234− ?~ q.tub
235− (fail tub)
236− ?. =(i.q.tub ']')
237− (fail tub)
238− ?~ t.q.tub
239− (fail tub)
240− ?: =(i.t.q.tub '-')
241− ?~ t.t.q.tub
242− (fail tub)
243− ?: =(i.t.t.q.tub ']')
244− (;~(pfix ser (cook |=(a=@ (con (bex ']') a)) sade)) tub)
245− (fail tub)
246− (;~(pfix ser (cook |=(a=@ (con (bex ']') a)) sade)) tub)
247− |= tub=nail
248− ?~ q.tub
249− (fail tub)
250− ?. =(i.q.tub '-')
251− (fail tub)
252− ?~ t.q.tub
253− (fail tub)
254− ?: =(i.t.q.tub '-')
255− ?~ t.t.q.tub
256− (fail tub)
257− ?: =(i.t.t.q.tub ']')
258− (;~(pfix hep (cook |=(a=@ (con (bex '-') a)) sade)) tub)
259− (fail tub)
260− (;~(pfix hep (cook |=(a=@ (con (bex '-') a)) sade)) tub)
261− (cook |=(a=[@ @] (con a)) ;~(plug seap sade))
262− ==
263− ::
264−
265−XX document
266−
267−### `++sade`
268−
269− ++ sade
270− %+ knee *@ |. ~+
271− ;~ pose
272− (cold (bex '-') (jest '-]'))
273− (cold 0 ser)
274− (cook |=([p=@ q=@] `@`(con p q)) ;~(plug seap sade))
275− ==
276− ::
277−
278−XX document
279−
280−### `++seap`
281−
282− ++ seap
283− %+ knee *@ |. ~+
284− ;~ pose
285− unid
286− %+ ifix (jest '[:')^(jest ':]')
287− ;~(pose ;~(pfix ket (cook flap chas)) chas)
288− %+ sear |=([a=@ b=@] ?:((gth a b) ~ (some (ranc a b))))
289− ;~(plug asp ;~(pfix hep alb))
290− |= tub=nail
291− ?~ q.tub
292− (fail tub)
293− ?~ t.q.tub
294− ((cook bex les) tub)
295− ?: =(i.t.q.tub '-')
296− ?~ t.t.q.tub
297− ((cook bex les) tub)
298− ?: =(i.t.t.q.tub ']')
299− ((cook bex les) tub)
300− (fail tub)
301− ((cook bex les) tub)
302− ;~(pfix bas escd)
303− ==
304− ::
305−
306−XX document
307−
308−### `++cape`
309−
310− ++ cape
311− %+ knee *tape |. ~+
312− ;~ pose
313− (cold ~ (jest '\\E'))
314− ;~(plug next cape)
315− (cook |=(a=char (tape [a ~])) next)
316− (full (easy ~))
317− ==
318−
319−XX document
320−
321−### `++chas`
322−
323− ++ chas :: ascii character set
324− =- (sear ~(get by -) sym)
325− %- mo ^- (list ,[@tas @I])
326− :~ alnum/alnum alpha/alpha ascii/ascii blank/blank cntrl/cntrl
327− digit/digit graph/graph lower/lower print/print punct/punct
328− space/space upper/upper word/wordc xdigit/xdigit
329− ==
330− :: Character sets
331−
332−++ alnum :(con lower upper digit)
333−
334−
335− XX document
336−
337− ###++alpha
338−
339−++ alpha :(con lower upper)
340−
341−
342− XX document
343−
344− ###++ascii
345−
346−++ ascii (ranc 0 127)
347−
348−
349− ++ blank (con (bex 32) (bex 9))
350−
351−XX document
352−
353−### `++cntrl`
354−
355− ++ cntrl :(con (ranc 0 31) (bex 127))
356−
357−XX document
358−
359−### `++digit`
360−
361− ++ digit (ranc '0' '9')
362−
363−XX document
364−
365−### `++graph`
366−
367− ++ graph (ranc 33 126)
368−
369−XX document
370−
371−### `++lower`
372−
373− ++ lower (ranc 'a' 'z')
374−
375−XX document
376−
377−### `++print`
378−
379− ++ print (ranc 32 126)
380−
381−XX document
382−
383−### `++punct`
384−
385− ++ punct ;: con
386− (ranc '!' '/')
387− (ranc ':' '@')
388− (ranc '[' '`')
389− (ranc '{' '~')
390− ==
391−
392−XX document
393−
394−### `++space`
395−
396− ++ space :(con (ranc 9 13) (bex ' '))
397−
398−XX document
399−
400−### `++upper`
401−
402− ++ upper (ranc 'A' 'Z')
403−
404−XX document
405−
406−### `++white`
407−
408− ++ white :(con (bex ' ') (ranc 9 10) (ranc 12 13))
409−
410−XX document
411−
412−### `++wordc`
413−
414− ++ wordc :(con digit lower upper (bex '_'))
415−
416−XX document
417−
418−### `++xdigit`
419−
420− ++ xdigit :(con (ranc 'a' 'f') (ranc 'A' 'F') digit)
421− ::
422−
423−XX document
424−
425−### `++chad`
426−
427− ++ chad
428− %+ knee *rege |. ~+
429− ;~(pose (stag %lite nor) (stag %brac unid) ;~(pfix bas escp))
430− ::
431−
432−XX document
433−
434−### `++escd`
435−
436− ++ escd
437− %+ knee *@ |. ~+
438− ;~ pose
439− (cold (bex 7) (just 'a'))
440− (cold (bex 9) (just 't'))
441− (cold (bex 10) (just 'n'))
442− (cold (bex 11) (just 'v'))
443− (cold (bex 12) (just 'f'))
444− (cold (bex 13) (just 'r'))
445− (cold (bex 0) (just '0'))
446− (sear |=(a=@ ?:((lth a 256) (some (bex a)) ~)) (bass 8 (stun [2 3] cit)))
447− (cook bex ;~(pfix (just 'x') (bass 16 (stun [2 2] hit))))
448− (cook bex (ifix [(jest 'x{') ker] (bass 16 (stun [2 2] hit))))
449− (cook bex mis)
450− ==
451− ::
452−
453−XX document
454−
455−### `++escp`
456−
457− ++ escp
458− %+ knee *rege |. ~+
459− ;~ pose
460− (cold %empt (just 'Q'))
461− (cold [%lite `@tD`0] (just '0'))
462− (cold [%lite `@tD`7] (just 'a'))
463− (cold [%lite `@tD`9] (just 't'))
464− (cold [%lite `@tD`10] (just 'n'))
465− (cold [%lite `@tD`11] (just 'v'))
466− (cold [%lite `@tD`12] (just 'f'))
467− (cold [%lite `@tD`13] (just 'r'))
468− (sear |=(a=@ ?:((lth a 256) (some [%lite a]) ~)) (bass 8 (stun [2 3] cit)))
469− (stag %lite ;~(pfix (just 'x') (bass 16 (stun [2 2] hit))))
470− (stag %lite (ifix [(jest 'x{') ker] (bass 16 (stun [2 2] hit))))
471− (cold %dote (just 'C'))
472− (cold %sart (just 'A'))
473− (cold %ende (just 'z'))
474− (cold %boun (just 'b'))
475− (cold %bout (just 'B'))
476− (stag %brac (cold wordc (just 'w')))
477− (stag %brac (cold (flap wordc) (just 'W')))
478− (stag %lite mis)
479− ==
480− ::
481−
482−XX document
483−
484−### `++unid`
485−
486− ++ unid
487− %+ knee *@ |. ~+
488− ;~ pose
489− (cold digit (jest '\\d'))
490− (cold (flap digit) (jest '\\D'))
491− (cold white (jest '\\s'))
492− (cold (flap white) (jest '\\S'))
493− (cold wordc (jest '\\w'))
494− (cold (flap wordc) (jest '\\W'))
495− ==
496− --
497− ::
498−
499−XX document
500−
501−### `++ra`
502−
503− ++ ra :: regex engine
504− |_ a=rege
505−
506−XX document
507−
508−### `++proc`
509−
510− ++ proc :: capture numbering
511− |= b=@
512− =- -(+ +>.$(a a))
513− ^- [p=@ a=rege]
514− ?- a
515− [%capt *] =+ foo=$(a p.a, b +(b))
516− [p.foo [%capt a.foo b]]
517− [%eith *] =+ foo=$(a p.a)
518− =+ bar=$(a q.a, b p.foo)
519− [p.bar [%eith a.foo a.bar]]
520− [%pair *] =+ foo=$(a p.a)
521− =+ bar=$(a q.a, b p.foo)
522− [p.bar [%pair a.foo a.bar]]
523− [%manl *] =+ foo=$(a p.a)
524− [p.foo [%manl a.foo]]
525− [%plll *] =+ foo=$(a p.a)
526− [p.foo [%plll a.foo]]
527− [%binl *] =+ foo=$(a p.a)
528− [p.foo [%binl a.foo q.a]]
529− [%betl *] =+ foo=$(a p.a)
530− [p.foo [%betl a.foo q.a r.a]]
531− [%mant *] =+ foo=$(a p.a)
532− [p.foo [%mant a.foo]]
533− [%plls *] =+ foo=$(a p.a)
534− [p.foo [%plls a.foo]]
535− [%bant *] =+ foo=$(a p.a)
536− [p.foo [%bant a.foo q.a]]
537− [%bint *] =+ foo=$(a p.a)
538− [p.foo [%bint a.foo q.a]]
539− [%betw *] =+ foo=$(a p.a)
540− [p.foo [%betw a.foo q.a r.a]]
541− * [b a]
542− ==
543− ::
544−
545−XX document
546−
547−### `++cont`
548−
549− ++ cont
550− |= [a=(map ,@u tape) b=(map ,@u tape)]
551− (~(gas by _(map ,@u tape)) (weld (~(tap by a)) (~(tap by b))))
552− ::
553−
554−XX document
555−
556−### `++abor`
557−
558− ++ abor
559− |= [a=char b=(unit ,[tape (map ,@u tape)])]
560− ^- (unit ,[tape (map ,@u tape)])
561− ?~ b
562− b
563− [~ [[a -.u.b] +.u.b]]
564− ::
565−
566−XX document
567−
568−### `++matc`
569−
570− ++ matc
571− |= [b=tape c=tape]
572− ^- (unit (map ,@u tape))
573− =+ foo=`(unit ,[tape (map ,@u tape)])`(deep b %empt c)
574− (bind foo |*(a=^ (~(put by +.a) 0 -.a)))
575− ::
576−
577−XX document
578−
579−### `++chet`
580−
581− ++ chet
582− |= [b=(unit ,[tape (map ,@u tape)]) c=tape d=tape]
583− ^- (unit ,[tape (map ,@u tape)])
584− ?~ b
585− b
586− ?~ -.u.b
587− b
588− =+ bar=(deep (slag (lent -.u.b) c) %empt d)
589− ?~ bar
590− bar
591− b
592−
593−XX document
594−
595−### `++blak`
596−
597− ++ blak (some ["" _(map ,@u tape)])
598−
599−XX document
600−
601−### `++word`
602−
603− ++ word |=(a=char =((dis wordc:rags (bex a)) 0))
604−
605−XX document
606−
607−### `++deep`
608−
609− ++ deep
610− |= [b=tape c=rege d=tape]
611− ^- (unit ,[tape (map ,@u tape)])
612− ?- a
613− %dote ?~(b ~ (some [[i.b ~] _(map ,@u tape)]))
614− %ende ?~(b blak ~)
615− %sart ?:(=(b d) blak ~)
616− %empt blak
617− %boun =+ ^= luc
618− ?: =(b d)
619− &
620− =+ foo=(slag (dec (sub (lent d) (lent b))) d)
621− (word -.foo)
622− =+ cuc=?~(b & (word -.b))
623− ?:(!=(luc cuc) blak ~)
624− %bout =+ ^= luc
625− ?: =(b d)
626− &
627− =+ foo=(slag (dec (sub (lent d) (lent b))) d)
628− (word -.foo)
629− =+ cuc=?~(b & (word -.b))
630− ?:(=(luc cuc) blak ~)
631− [%capt *] =+ foo=$(a p.a)
632− ?~ foo
633− foo
634− =+ ft=u.foo
635− =+ bar=$(a c, b (slag (lent -.ft) b), c %empt)
636− ?~ bar
637− bar
638− [~ [-.ft (~(put by +.ft) q.a -.ft)]]
639− [%lite *] ?~(b ~ ?:(=(i.b p.a) (some [[i.b ~] _(map ,@u tape)]) ~))
640− [%brac *] ?~ b
641− ~
642− ?. =((dis (bex `@`i.b) p.a) 0)
643− (some [[i.b ~] _(map ,@u tape)])
644− ~
645− [%eith *] =+ foo=(chet(a c) $(a p.a) b d)
646− =+ bar=(chet(a c) $(a q.a) b d)
647− ?~ foo
648− bar
649− ?~ bar
650− foo
651− =+ ft=u.foo
652− =+ bt=u.bar
653− ?: (gte (lent -.ft) (lent -.bt))
654− foo
655− bar
656− [%pair *] =+ foo=$(a p.a, c [%pair q.a c])
657− ?~ foo
658− foo
659− =+ ft=u.foo
660− =+ bar=$(a q.a, b (slag (lent -.ft) b))
661− ?~ bar
662− bar
663− =+ bt=u.bar
664− [~ [(weld -.ft -.bt) (cont +.ft +.bt)]]
665− [%manl *] =+ foo=$(a p.a)
666− ?~ foo
667− blak
668− ?~ -.u.foo
669− blak
670− $(a [%eith %empt [%pair p.a [%eith %empt a]]])
671− [%mant *] =+ foo=$(a p.a)
672− ?~ foo
673− blak
674− =+ ft=u.foo
675− ?~ -.ft
676− blak
677− $(a [%eith [%pair p.a [%eith a %empt]] %empt])
678− [%plls *] $(a [%pair p.a [%mant p.a]])
679− [%plll *] $(a [%pair p.a [%manl p.a]])
680− [%binl *] =+ min=?:(=(q.a 0) 0 (dec q.a))
681− ?: =(q.a 0)
682− $(a [%manl p.a])
683− $(a [%pair p.a [%binl p.a min]])
684− [%bant *] ?: =(0 q.a)
685− blak
686− $(a [%pair p.a [%bant p.a (dec q.a)]])
687− [%bint *] =+ min=?:(=(q.a 0) 0 (dec q.a))
688− ?: =(q.a 0)
689− $(a [%mant p.a])
690− $(a [%pair p.a [%bint p.a min]])
691− [%betw *] ?: =(0 r.a)
692− blak
693− ?: =(q.a 0)
694− $(a [%eith [%pair p.a [%betw p.a 0 (dec r.a)]] %empt])
695− $(a [%pair p.a [%betw p.a (dec q.a) (dec r.a)]])
696− [%betl *] ?: =(0 r.a)
697− blak
698− ?: =(q.a 0)
699− $(a [%eith %empt [%pair p.a [%betl p.a 0 (dec r.a)]]])
700− $(a [%pair p.a [%betl p.a (dec q.a) (dec r.a)]])
701− ==
702− --
703− ::
704−
705−XX document
706−
707−### `++rexp`
708−
709− ++ rexp :: Regex match
710− ~/ %rexp
711− |= [a=tape b=tape]
712− ^- (unit (unit (map ,@u tape)))
713− =+ ^= bar
714− |= [a=@ b=(map ,@u tape)]
715− ?: =(a 0)
716− b
717− =+ c=(~(get by b) a)
718− ?~ c
719− $(a (dec a), b (~(put by b) a ""))
720− $(a (dec a))
721− =+ par=(pars a)
722− ?~ par ~
723− =+ poc=(~(proc ra u.par) 1)
724− =+ c=b
725− |-
726− =+ foo=(matc:poc c b)
727− ?~ foo
728− ?~ c
729− [~ ~]
730− $(c t.c)
731− [~ [~ (bar (dec p.poc) u.foo)]]
732− ::
733−
734−XX document
735−
736−### `++repg`
737−
738− ++ repg :: Global regex replace
739− ~/ %repg
740− |= [a=tape b=tape c=tape]
741− ^- (unit tape)
742− =+ par=(pars a)
743− ?~ par ~
744− =+ poc=(~(proc ra u.par) 1)
745− =+ d=b
746− :- ~
747− |-
748− ^- tape
749− =+ foo=(matc:poc d b)
750− ?~ foo
751− ?~ d
752− ~
753− [i.d $(d t.d)]
754− =+ ft=(need (~(get by u.foo) 0))
755− ?~ d
756− c
757− (weld c $(d `tape`(slag (lent ft) `tape`d)))
758− ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
docs/system/hoon/library/2en.md−617
@@ -1,621 +1,4 @@
12eN pseudo-cryptography
12eN pseudo-cryptography
2=======================
2=======================
3
3
4−### `++un`
5−
6−Reversible scrambling core
7−
8− ++ un :: =(x (wred (wren x)))
9− |%
10−
11−A core that contains arms that perform reversible scrambling operations.
12−Used in the `@p` phonetic base.
13−
14−------------------------------------------------------------------------
15−
16−### `++wren`
17−
18−Conceal structure
19−
20−Scrambles a bytestring `pyn` by adding the current position to each
21−byte, looking it up in an s-box, and then performing the XOR operation
22−on the result, pushing it forward. Produces an atom.
23−
24−Accepts
25−-------
26−
27−`pyn` is an [atom]().
28−
29−
30−Produces
31−--------
32−
33−Source
34−------
35−
36− ++ wren :: conceal structure
37− |= pyn=@ ^- @
38− =+ len=(met 3 pyn)
39− ?: =(0 len)
40− 0
41− => .(len (dec len))
42− =+ mig=(zaft (xafo len (cut 3 [len 1] pyn)))
43− %+ can 3
44− %- flop ^- (list ,[@ @])
45− :- [1 mig]
46− |- ^- (list ,[@ @])
47− ?: =(0 len)
48− ~
49− => .(len (dec len))
50− =+ mog=(zyft :(mix mig (end 3 1 len) (cut 3 [len 1] pyn)))
51− [[1 mog] $(mig mog)]
52− ::
53−
54−Examples
55−--------
56−
57− ~zod/try=> `@ux`(wren:un 'testing')
58− 0x30.bf6a.b9fe.7d8f
59− ~zod/try=> `@ux`'testing'
60− 0x67.6e69.7473.6574
61− ~zod/try=> `@da`(wred:un (wren:un ~2001.2.5))
62− ~2001.2.5
63−
64−------------------------------------------------------------------------
65−
66−### `++wred`
67−
68−Restore structure
69−
70−Unscrambles a bytestring `cry` by subtracting the current position from
71−each byte, looking it up in an s-box, and performing the XOR operation
72−on the result, pushing it forward. Produces an atom.
73−
74−Accepts
75−-------
76−
77−`cry` is an [atom]().
78−
79−Produces
80−--------
81−
82−Source
83−------
84−
85− ++ wred :: restore structure
86− |= cry=@ ^- @
87− =+ len=(met 3 cry)
88− ?: =(0 len)
89− 0
90− => .(len (dec len))
91− =+ mig=(cut 3 [len 1] cry)
92− %+ can 3
93− %- flop ^- (list ,[@ @])
94− :- [1 (xaro len (zart mig))]
95− |- ^- (list ,[@ @])
96− ?: =(0 len)
97− ~
98− => .(len (dec len))
99− =+ mog=(cut 3 [len 1] cry)
100− [[1 :(mix mig (end 3 1 len) (zyrt mog))] $(mig mog)]
101− ::
102−
103−Examples
104−--------
105−
106− ~zod/try=> (wred:un 0x30.bf6a.b9fe.7d8f)
107− 29.113.321.805.538.676
108− ~zod/try=> `@t`(wred:un 0x30.bf6a.b9fe.7d8f)
109− 'testing'
110− ~zod/try=> (wred:un (wren:un 200.038.426))
111− 200.038.426
112−
113−------------------------------------------------------------------------
114−
115−### `++xafo`
116−
117−Add modulo 255
118−
119−Produces the sum of two atoms modulo 255, encoded as a nonzero byte.
120−
121−Accepts
122−-------
123−
124−A cell of two atoms, `a` and `b`.
125−
126−Source
127−------
128−
129− ++ xafo |=([a=@ b=@] +((mod (add (dec b) a) 255)))
130−
131−Examples
132−--------
133−
134− ~zod/try=> (xafo:un 5 6)
135− 11
136− ~zod/try=> (xafo:un 256 20)
137− 21
138−
139−------------------------------------------------------------------------
140−
141−### `++xaro`
142−
143−Subtract modulo 255
144−
145−Produces the difference between two atoms modulo 255, encoded as a
146−nonzero byte.
147−
148−Accepts
149−-------
150−
151−A cell of two atoms, `a` and `b`.
152−
153−Produces
154−--------
155−
156−An atom.
157−
158−Source
159−------
160−
161− ++ xaro |=([a=@ b=@] +((mod (add (dec b) (sub 255 (mod a 255))) 255)))
162−
163−Examples
164−--------
165−
166− ~zod/try=> (xaro:un 17 57)
167− 40
168− ~zod/try=> (xaro:un 265 12)
169− 2
170−
171−------------------------------------------------------------------------
172−
173−### `++zaft`
174−
175−Look up in 255 sub box
176−
177−The inverse of [`++zart`](). Looks up a nonzero byte`a\` in a substiution
178−box with 255 values, producing a unique nonzero byte.
179−
180−Accepts
181−-------
182−
183−`a` is an atom of one byte in length.
184−
185−
186−Produces
187−--------
188−
189−An atom.
190−
191−Source
192−------
193−
194− ++ zaft :: forward 255-sbox
195− |= a=@D
196− =+ ^= b
197− 0xcc.75bc.86c8.2fb1.9a42.f0b3.79a0.92ca.21f6.1e41.cde5.fcc0.
198− 7e85.51ae.1005.c72d.1246.07e8.7c64.a914.8d69.d9f4.59c2.8038.
199− 1f4a.dca2.6fdf.66f9.f561.a12e.5a16.f7b0.a39f.364e.cb70.7318.
200− 1de1.ad31.63d1.abd4.db68.6a33.134d.a760.edee.5434.493a.e323.
201− 930d.8f3d.3562.bb81.0b24.43cf.bea5.a6eb.52b4.0229.06b2.6704.
202− 78c9.45ec.d75e.58af.c577.b7b9.c40e.017d.90c3.87f8.96fa.1153.
203− 0372.7f30.1c32.ac83.ff17.c6e4.d36d.6b55.e2ce.8c71.8a5b.b6f3.
204− 9d4b.eab5.8b3c.e7f2.a8fe.9574.5de0.bf20.3f15.9784.9939.5f9c.
205− e609.564f.d8a4.b825.9819.94aa.2c08.8e4c.9b22.477a.2840.3ed6.
206− 3750.6ef1.44dd.89ef.6576.d00a.fbda.9ed2.3b6c.7b0c.bde9.2ade.
207− 5c88.c182.481a.1b0f.2bfd.d591.2726.57ba
208− (cut 3 [(dec a) 1] b)
209− ::
210−
211−Examples
212−--------
213−
214− ~zod/try=> (zaft:un 0x12)
215− 42
216− ~zod/try=> (zaft:un 0xff)
217− 204
218− ~zod/try=> (zaft:un 0x0)
219− ! decrement-underflow
220− ! exit
221−
222−------------------------------------------------------------------------
223−
224−### `++zart`
225−
226−Reverse look up in 255 sub box
227−
228−The inverse of [`++zaft`](). Looks up the index of a nonzero byte `a` in
229−the substitution box with 255 values, producing a unique nonzero byte.
230−
231−Accepts
232−-------
233−
234−`a` is an atom of one byte in length.
235−
236−Produces
237−--------
238−
239−An atom.
240−
241−Source
242−------
243−
244− ++ zart :: reverse 255-sbox
245− |= a=@D
246− =+ ^= b
247− 0x68.4f07.ea1c.73c9.75c2.efc8.d559.5125.f621.a7a8.8591.5613.
248− dd52.40eb.65a2.60b7.4bcb.1123.ceb0.1bd6.3c84.2906.b164.19b3.
249− 1e95.5fec.ffbc.f187.fbe2.6680.7c77.d30e.e94a.9414.fd9a.017d.
250− 3a7e.5a55.8ff5.8bf9.c181.e5b6.6ab2.35da.50aa.9293.3bc0.cdc6.
251− f3bf.1a58.4130.f844.3846.744e.36a0.f205.789e.32d8.5e54.5c22.
252− 0f76.fce7.4569.0d99.d26e.e879.dc16.2df4.887f.1ffe.4dba.6f5d.
253− bbcc.2663.1762.aed7.af8a.ca20.dbb4.9bc7.a942.834c.105b.c4d4.
254− 8202.3e61.a671.90e6.273d.bdab.3157.cfa4.0c2e.df86.2496.f7ed.
255− 2b48.2a9d.5318.a343.d128.be9c.a5ad.6bb5.6dfa.c5e1.3408.128d.
256− 2c04.0339.97a1.2ff0.49d0.eeb8.6c0a.0b37.b967.c347.d9ac.e072.
257− e409.7b9f.1598.1d3f.33de.8ce3.8970.8e7a
258− (cut 3 [(dec a) 1] b)
259− ::
260−
261−Examples
262−--------
263−
264− ~zod/try=> `@ux`(zart:un 204)
265− 0xff
266− ~zod/try=> `@ux`(zart:un 42)
267− 0x12
268−
269−------------------------------------------------------------------------
270−
271−### `++zyft`
272−
273−Lookup byte in 256 sub box
274−
275−The inverse of [`++zyrt`](). Looks up a byte `a` in a substituion box
276−with 256 values, producing a byte.
277−
278−Accepts
279−-------
280−
281−`a` is an [atom]() of one byte in length.
282−
283−Produces
284−--------
285−
286−An atom.
287−
288−Source
289−------
290−
291− ++ zyft :: forward 256-sbox
292− |= a=@D
293− =+ ^= b
294− 0xbb49.b71f.b881.b402.17e4.6b86.69b5.1647.115f.dddb.7ca5.
295− 8371.4bd5.19a9.b092.605d.0d9b.e030.a0cc.78ba.5706.4d2d.
296− 986a.768c.f8e8.c4c7.2f1c.effe.3cae.01c0.253e.65d3.3872.
297− ce0e.7a74.8ac6.daac.7e5c.6479.44ec.4143.3d20.4af0.ee6c.
298− c828.deca.0377.249f.ffcd.7b4f.eb7d.66f2.8951.042e.595a.
299− 8e13.f9c3.a79a.f788.6199.9391.7fab.6200.4ce5.0758.e2f1.
300− 7594.c945.d218.4248.afa1.e61a.54fb.1482.bea4.96a2.3473.
301− 63c2.e7cb.155b.120a.4ed7.bfd8.b31b.4008.f329.fca3.5380.
302− 9556.0cb2.8722.2bea.e96e.3ac5.d1bc.10e3.2c52.a62a.b1d6.
303− 35aa.d05e.f6a8.0f3b.31ed.559d.09ad.f585.6d21.fd1d.8d67.
304− 370b.26f4.70c1.b923.4684.6fbd.cf8b.5036.0539.9cdc.d93f.
305− 9068.1edf.8f33.b632.d427.97fa.9ee1
306− (cut 3 [a 1] b)
307− ::
308−
309−Examples
310−--------
311−
312− ~zod/try=> (zyft:un 0x12)
313− 57
314− ~zod/try=> (zyft:un 0x0)
315− 225
316− ~zod/try=> (zyft:un 0xff)
317− 187
318−
319−------------------------------------------------------------------------
320−
321−### `++zyrt`
322−
323−Reverse lookup byte in 256 sub box
324−
325−The inverse of [`++zyft`](/doc/hoon/library/2en#++zyft). Looks up a byte `a` in a substituion box
326−with 256 values, producing a byte.
327−
328−Accepts
329−-------
330−
331−`a` is an [atom]() of one byte in length.
332−
333−Produces
334−--------
335−
336−An atom.
337−
338−Source
339−------
340−
341− ++ zyrt :: reverse 256-sbox
342− |= a=@D
343− =+ ^= b
344− 0x9fc8.2753.6e02.8fcf.8b35.2b20.5598.7caa.c9a9.30b0.9b48.
345− 47ce.6371.80f6.407d.00dd.0aa5.ed10.ecb7.0f5a.5c3a.e605.
346− c077.4337.17bd.9eda.62a4.79a7.ccb8.44cd.8e64.1ec4.5b6b.
347− 1842.ffd8.1dfb.fd07.f2f9.594c.3be3.73c6.2cb6.8438.e434.
348− 8d3d.ea6a.5268.72db.a001.2e11.de8c.88d3.0369.4f7a.87e2.
349− 860d.0991.25d0.16b9.978a.4bf4.2a1a.e96c.fa50.85b5.9aeb.
350− 9dbb.b2d9.a2d1.7bba.66be.e81f.1946.29a8.f5d2.f30c.2499.
351− c1b3.6583.89e1.ee36.e0b4.6092.937e.d74e.2f6f.513e.9615.
352− 9c5d.d581.e7ab.fe74.f01b.78b1.ae75.af57.0ec2.adc7.3245.
353− 12bf.2314.3967.0806.31dc.cb94.d43f.493c.54a6.0421.c3a1.
354− 1c4a.28ac.fc0b.26ca.5870.e576.f7f1.616d.905f.ef41.33bc.
355− df4d.225e.2d56.7fd6.1395.a3f8.c582
356− (cut 3 [a 1] b)
357−
358−Examples
359−--------
360−
361− ~zod/try=> `@ux`(zyrt:un 57)
362− 0x12
363− ~zod/try=> `@ux`(zyrt:un 225)
364− 0x0
365− ~zod/try=> `@ux`(zyrt:un 187)
366− 0xff
367−
368−### `++ob`
369−
370−Reversible scrambling core, v2
371−
372− ++ ob
373− |%
374−
375−A core for performing reversible scrambling operations for the `@p` phonetic base.
376−
377−------------------------------------------------------------------------
378−
379−### `++feen`
380−
381−Conceal structure, v2
382−
383−Randomly permutes atoms that fit into 17 to 32 bits into one another. If the
384−atom fits into 33 to 64 bits, does the same permutation on the low 32 bits
385−only. Otherwise, passes the atom through unchanged.
386−
387−Accepts
388−-------
389−
390−An atom.
391−
392−Produces
393−--------
394−
395−An atom.
396−
397−Source
398−------
399−
400− ++ feen :: conceal structure v2
401− |= pyn=@ ^- @
402− ?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff))
403− (add 0x1.0000 (fice (sub pyn 0x1.0000)))
404− ?: &((gte pyn 0x1.0000.0000) (lte pyn 0xffff.ffff.ffff.ffff))
405− =+ lo=(dis pyn 0xffff.ffff)
406− =+ hi=(dis pyn 0xffff.ffff.0000.0000)
407− %+ con hi
408− (add 0x1.0000 (fice (sub lo 0x1.0000)))
409− pyn
410−
411−Examples
412−--------
413−
414−
415−------------------------------------------------------------------------
416−
417−### `++fend`
418−
419−XX
420−
421−Randomly permutes atoms that fit into 17 to 32 bits into one another, and
422−randomly permutes the low 32 bits of atoms that fit into 33 to 64 bits;
423−otherwise, passes the atom through unchanged. The permutation is the inverse of
424−the one applied by [`++feen`]().
425−
426−Accepts
427−-------
428−
429−An atom.
430−
431−Produces
432−--------
433−
434−An atom.
435−
436−Source
437−------
438−
439− ++ fend :: restore structure v2
440− |= cry=@ ^- @
441− ?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff))
442− (add 0x1.0000 (teil (sub cry 0x1.0000)))
443− ?: &((gte cry 0x1.0000.0000) (lte cry 0xffff.ffff.ffff.ffff))
444− =+ lo=(dis cry 0xffff.ffff)
445− =+ hi=(dis cry 0xffff.ffff.0000.0000)
446− %+ con hi
447− (add 0x1.0000 (teil (sub lo 0x1.0000)))
448− cry
449−
450−Examples
451−--------
452−
453−------------------------------------------------------------------------
454−
455−### `++fice`
456−
457−XX
458−
459−Applies a 3-round Feistel-like cipher to randomly permute atoms in the range `0` to `2^32 - 2^16`. The construction given in Black and Rogaway is ideal for a domain with a size of that form, and as with a conventionel Feistel cipher, three rounds suffice to make the permutation pseudorandom.
460−
461−Accepts
462−-------
463−
464−An atom.
465−
466−Produces
467−--------
468−
469−An atom.
470−
471−Source
472−------
473−
474− ++ fice :: adapted from
475− |= nor=@ :: black and rogaway
476− ^- @ :: "ciphers with
477− =+ ^= sel :: arbitrary finite
478− %+ rynd 2 :: domains", 2002
479− %+ rynd 1
480− %+ rynd 0
481− [(mod nor 65.535) (div nor 65.535)]
482− (add (mul 65.535 -.sel) +.sel)
483−
484−Examples
485−--------
486−
487−------------------------------------------------------------------------
488−
489−### `++teil`
490−
491−XX
492−
493−Applies the reverse of the Feistel-like cipher applied by [`++fice`](). Unlike
494−a conventional Feistel cipher that is its own inverse if keys are used in
495−reverse order, this Feistel-like cipher uses two moduli that must be swapped
496−when applying the reverse transformation.
497−
498−Accepts
499−-------
500−
501−An atom.
502−
503−Produces
504−--------
505−
506−An atom.
507−
508−Source
509−------
510−
511− ++ teil :: reverse ++fice
512− |= vip=@
513− ^- @
514− =+ ^= sel
515− %+ rund 0
516− %+ rund 1
517− %+ rund 2
518− [(mod vip 65.535) (div vip 65.535)]
519− (add (mul 65.535 -.sel) +.sel)
520−
521−Examples
522−--------
523−
524−------------------------------------------------------------------------
525−
526−### `++rynd`
527−
528−XX
529−
530−A single round of the Feistel-like cipher [`++fice`](). AES ([`++aesc`]()) is
531−used as the round function.
532−
533−Accepts
534−-------
535−
536−A cell of three atoms, `n`, `l`, and `r`.
537−
538−Produces
539−--------
540−
541−A cell of two atoms.
542−
543−Source
544−------
545−
546− ++ rynd :: feistel round
547− |= [n=@ l=@ r=@]
548− ^- [@ @]
549− :- r
550− ?~ (mod n 2)
551− (~(sum fo 65.535) l (en:aesc (snag n raku) r))
552− (~(sum fo 65.536) l (en:aesc (snag n raku) r))
553−
554−Examples
555−--------
556−
557−------------------------------------------------------------------------
558−
559−### `++rund`
560−
561−XX
562−
563−A single round of the Feistel-like reverse cipher [`++teil`]().
564−
565−Accepts
566−-------
567−
568−A cell of three atoms, `n`, `l`, and `r`.
569−
570−Produces
571−--------
572−
573−A cell of two atoms.
574−
575−Source
576−------
577−
578− ++ rund :: reverse round
579− |= [n=@ l=@ r=@]
580− ^- [@ @]
581− :- r
582− ?~ (mod n 2)
583− (~(dif fo 65.535) l (en:aesc (snag n raku) r))
584− (~(dif fo 65.536) l (en:aesc (snag n raku) r))
585−
586−Examples
587−--------
588−
589−------------------------------------------------------------------------
590−
591−### `++raku`
592−
593−XX
594−
595−
596−Accepts
597−-------
598−
599−A list of atoms of [odor]() [`@ux`]() (hexadecimal).
600−
601−Produces
602−--------
603−
604−Arbitrary keys for use with [`++aesc`]().
605−
606−Source
607−------
608−
609− ++ raku
610− ^- (list ,@ux)
611− :~ 0x15f6.25e3.083a.eb3e.7a55.d4db.fb99.32a3.
612− 43af.2750.219e.8a24.e5f8.fac3.6c36.f968
613− 0xf2ff.24fe.54d0.1abd.4b2a.d8aa.4402.8e88.
614− e82f.19ec.948d.b1bb.ed2e.f791.83a3.8133
615− 0xa3d8.6a7b.400e.9e91.187d.91a7.6942.f34a.
616− 6f5f.ab8e.88b9.c089.b2dc.95a6.aed5.e3a4
617− ==
618−
619−Examples
620−--------
621
4
docs/system/hoon/library/2eo.md−404
@@ -1,420 +1,16 @@
12eO virtualization
12eO virtualization
2==================
2==================
3
3
4−### `++mack`
5−
6−Nock subject to unit
7−
8−Accepts a nock subject-formula cell and wraps it into a [`++unit`]().
9−`fol` is pure nock, meaning that nock `11` operations result in a block,
10−producing a `~`.
11−
12−Accepts
13−-------
14−
15−`sub` is a subject [noun]().
16−
17−`fol` is a formula noun, which is generally a `++nock`.
18−
19−Produces
20−--------
21−
22−The `++unit` of a noun.
23−
24−Source
25−------
26−
27− ++ mack
28− |= [sub=* fol=*]
29− ^- (unit)
30− =+ ton=(mink [sub fol] |=(* ~))
31− ?.(?=([0 *] ton) ~ [~ p.ton])
32− ::
33−
34−Examples
35−--------
36−
37− ~zod/try=> (mack [[1 2 3] [0 1]])
38− [~ [1 2 3]]
39− ~zod/try=> (mack [41 4 0 1])
40− [~ 42]
41− ~zod/try=> (mack [4 0 4])
42− ~
43− ~zod/try=> (mack [[[0 2] [1 3]] 4 4 4 4 0 5])
44− [~ 6]
45− ~zod/try=> ;;((unit ,@tas) (mack [[1 %yes %no] 6 [0 2] [0 6] 0 7]))
46− [~ %no]
47−
48------------------------------------------------------------------------
4------------------------------------------------------------------------
49
5
50−### `++mink`
51−
52−Mock interpreter
53−
54−Bottom-level [mock]() (virtual nock) interpreter. Produces a
55−[`++tone`](), a nock computation result. If nock 11 is invoked, `sky`
56−computes on the subject and produces a [`++unit`]() result. An empty
57−result becomes a `%1` `++tone`, indicating a block.
58−
59−Accepts
60−-------
61−
62−`sub` is the subject as a [noun]().
63−
64−`fol` is the formula as a noun.
65−
66−`sky` is an [`%iron`]() gate invoked with [nock operator 11]().
67−
68−Produces
69−--------
70−
71−A `++tone`.
72−
73−Source
74−------
75−
76− ++ mink
77− ~/ %mink
78− |= [[sub=* fol=*] sky=$+(* (unit))]
79− =+ tax=*(list ,[@ta *])
80− |- ^- tone
81− ?@ fol
82− [%2 tax]
83− ?: ?=(^ -.fol)
84− =+ hed=$(fol -.fol)
85− ?: ?=(%2 -.hed)
86− hed
87− =+ tal=$(fol +.fol)
88− ?- -.tal
89− %0 ?-(-.hed %0 [%0 p.hed p.tal], %1 hed)
90− %1 ?-(-.hed %0 tal, %1 [%1 (weld p.hed p.tal)])
91− %2 tal
92− ==
93− ?+ fol
94− [%2 tax]
95− ::
96− [0 b=@]
97− ?: =(0 b.fol) [%2 tax]
98− ?: =(1 b.fol) [%0 sub]
99− ?: ?=(@ sub) [%2 tax]
100− =+ [now=(cap b.fol) lat=(mas b.fol)]
101− $(b.fol lat, sub ?:(=(2 now) -.sub +.sub))
102− ::
103− [1 b=*]
104− [%0 b.fol]
105− ::
106− [2 b=[^ *]]
107− =+ ben=$(fol b.fol)
108− ?. ?=(%0 -.ben) ben
109− ?>(?=(^ p.ben) $(sub -.p.ben, fol +.p.ben))
110− ::?>(?=(^ p.ben) $([sub fol] p.ben)
111− ::
112− [3 b=*]
113− =+ ben=$(fol b.fol)
114− ?. ?=(%0 -.ben) ben
115− [%0 .?(p.ben)]
116− ::
117− [4 b=*]
118− =+ ben=$(fol b.fol)
119− ?. ?=(%0 -.ben) ben
120− ?. ?=(@ p.ben) [%2 tax]
121− [%0 .+(p.ben)]
122− ::
123− [5 b=*]
124− =+ ben=$(fol b.fol)
125− ?. ?=(%0 -.ben) ben
126− ?. ?=(^ p.ben) [%2 tax]
127− [%0 =(-.p.ben +.p.ben)]
128− ::
129− [6 b=* c=* d=*]
130− $(fol =>(fol [2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]))
131− ::
132− [7 b=* c=*] $(fol =>(fol [2 b 1 c]))
133− [8 b=* c=*] $(fol =>(fol [7 [[0 1] b] c]))
134− [9 b=* c=*] $(fol =>(fol [7 c 0 b]))
135− [10 @ c=*] $(fol c.fol)
136− [10 [b=* c=*] d=*]
137− =+ ben=$(fol c.fol)
138− ?. ?=(%0 -.ben) ben
139− ?: ?=(?(%hunk %lose %mean %spot) b.fol)
140− $(fol d.fol, tax [[b.fol p.ben] tax])
141− $(fol d.fol)
142− ::
143− [11 b=*]
144− =+ ben=$(fol b.fol)
145− ?. ?=(%0 -.ben) ben
146− =+ val=(sky p.ben)
147− ?~(val [%1 p.ben ~] [%0 u.val])
148− ::
149− ==
150− ::
151−
152−Examples
153−--------
154−
155− ~zod/try=> (mink [20 [4 0 1]] ,~)
156− [%0 p=21]
157− ~zod/try=> (mink [[90 5 3] [0 3]] ,~)
158− [%0 p=[5 3]]
159− ~zod/try=> (mink 20^[4 0 1] ,~)
160− [%0 p=21]
161− ~zod/try=> (mink [90 5 3]^[0 3] ,~)
162− [%0 p=[5 3]]
163− ~zod/try=> (mink [0]^[11 1 20] ,~)
164− [%1 p=~[20]]
165− ~zod/try=> (mink [0]^[11 1 20] |=(a=* `[40 a]))
166− [%0 p=[40 20]]
167− ~zod/try=> (mink [5]^[0 2] ,~)
168− [%2 p=~]
169− ~zod/try=> (mink [5]^[10 yelp/[0 1] 0 0] ,~)
170− [%2 p=~[[~.yelp 5]]]
171−
172------------------------------------------------------------------------
6------------------------------------------------------------------------
173
7
174−### `++mock`
175−
176−Compute formula on subject with hint
177−
178−Produces a [`++toon`](), which is either a sucessful, blocked, or
179−crashed result. If nock 11 is invoked, `sky` computes on the subject and
180−produces a [`++unit`]() result. An empty result becomes a `%1` `++tune`,
181−indicating a block.
182−
183−Accepts
184−-------
185−
186−`sub` is the subject as a [noun]().
187−
188−`fol` is the formula as a noun.
189−
190−`sky` is an [%iron]() gate invoked with [nock operator 11]().
191−
192−Produces
193−--------
194−
195−The `++unit` of a noun.
196−
197−Source
198−------
199−
200− ++ mock
201− |= [[sub=* fol=*] sky=$+(* (unit))]
202− (mook (mink [sub fol] sky))
203− ::
204−
205−Examples
206−--------
207−
208− ~zod/try=> (mock [5 4 0 1] ,~)
209− [%0 p=6]
210− ~zod/try=> (mock [~ 11 1 0] |=(* `999))
211− [%0 p=999]
212− ~zod/try=> (mock [~ 0 1.337] ,~)
213− [%2 p=~]
214− ~zod/try=> (mock [~ 11 1 1.337] ,~)
215− [%1 p=~[1.337]]
216− ~zod/try=> (mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[+<]))
217− [%0 p=14]
218− ~zod/try=> (mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[<+<>]))
219− [%0 p=[49 52 0]]
220− ~zod/try=> ;;(tape +:(mock [[[4 4 4 4 0 3] 10] 11 9 2 0 1] |=(* `[<+<>])))
221− "14"
222−
223------------------------------------------------------------------------
8------------------------------------------------------------------------
224
9
225−### `++mook`
226−
227−Intelligently render crash annotation
228−
229−Converts a `%2` `++tone` nock stack trace to a list of [`++tank`]().
230−Each may be a tank, cord, [`++spot`](), or trapped tank.
231−
232−Accepts
233−-------
234−
235−`ton` is a [`++tone`]().
236−
237−Produces
238−--------
239−
240−A [`++toon`]().
241−
242−Source
243−------
244−
245− ++ mook
246− |= ton=tone
247− ^- toon
248− ?. ?=([2 *] ton) ton
249− :- %2
250− =+ yel=(lent p.ton)
251− =. p.ton
252− ?. (gth yel 256) p.ton
253− %+ weld
254− (scag 128 p.ton)
255− ^- (list ,[@ta *])
256− :_ (slag (sub yel 128) p.ton)
257− :- %lose
258− %+ rap 3
259− ;: weld
260− "[skipped "
261− ~(rend co %$ %ud (sub yel 256))
262− " frames]"
263− ==
264− |- ^- (list tank)
265− ?~ p.ton ~
266− =+ rex=$(p.ton t.p.ton)
267− ?+ -.i.p.ton rex
268− %hunk [(tank +.i.p.ton) rex]
269− %lose [[%leaf (rip 3 (,@ +.i.p.ton))] rex]
270− %mean :_ rex
271− ?@ +.i.p.ton [%leaf (rip 3 (,@ +.i.p.ton))]
272− =+ mac=(mack +.i.p.ton +<.i.p.ton)
273− ?~(mac [%leaf "####"] (tank u.mac))
274− %spot :_ rex
275− =+ sot=(spot +.i.p.ton)
276− :- %leaf
277− ;: weld
278− ~(ram re (smyt p.sot))
279− ":<["
280− ~(rend co ~ %ud p.p.q.sot)
281− " "
282− ~(rend co ~ %ud q.p.q.sot)
283− "].["
284− ~(rend co ~ %ud p.q.q.sot)
285− " "
286− ~(rend co ~ %ud q.q.q.sot)
287− "]>"
288− ==
289− ==
290− ::
291−
292−Examples
293−--------
294−
295− ~zod/try=> (mook [%0 5 4 5 1])
296− [%0 p=[5 4 5 1]]
297− ~zod/try=> (mook [%2 ~[[%hunk %rose ["<" "," ">"] ~[[%leaf "err"]]]]])
298− [%2 p=~[[%rose p=[p="<" q="," r=">"] q=[i=[%leaf p="err"] t=~]]]]
299− ~zod/try=> (mook [%2 ~[[%malformed %elem] [%lose 'do print']]])
300− [%2 p=~[[%leaf p="do print"]]]
301− ~zod/try=> (mook [%2 ~[[%mean |.(>(add 5 6)<)]]])
302− [%2 p=~[[%leaf p="11"]]]
303− ~zod/try=> (mook [%2 ~[[%spot /b/repl [1 1]^[1 2]] [%mean |.(!!)]]])
304− [%2 p=~[[%leaf p="/b/repl/:<[1 1].[1 2]>"] [%leaf p="####"]]]
305−
306------------------------------------------------------------------------
10------------------------------------------------------------------------
307
11
308−### `++mang`
309−
310−Unit: Slam gate with sample
311−
312−Produces a [`++unit`]() computation result from slamming `gat` with
313−`sam`, using `sky` to compute or block on nock 11 when applicable.
314−Similar to [`++mong`]().
315−
316−Accepts
317−-------
318−
319−`gat` is a [noun]() that is generally a [`gate`]().
320−
321−`sam` is a [`sample`]() noun.
322−
323−`sky` is an [%iron]() gate invoked with [nock operator 11]().
324−
325−Produces
326−--------
327−
328−The `++unit` of a noun.
329−
330−Source
331−------
332−
333− ++ mang
334− |= [[gat=* sam=*] sky=$+(* (unit))]
335− ^- (unit)
336− =+ ton=(mong [[gat sam] sky])
337− ?.(?=([0 *] ton) ~ [~ p.ton])
338− ::
339−
340−Examples
341−--------
342−
343− ~zod/try=> (mang [|=(@ 20) ~] ,~)
344− [~ 20]
345− ~zod/try=> (mang [|=(@ !!) ~] ,~)
346− ~
347− ~zod/try=> (mang [|=(a=@ (add 20 a)) ~] ,~)
348− [~ 20]
349− ~zod/try=> (mang [|=(a=[@ @] (add 20 -.a)) ~] ,~)
350− ~
351− ~zod/try=> (mang [|=(a=[@ @] (add 20 -.a)) [4 6]] ,~)
352− [~ 24]
353− ~zod/try=> (mang [|=(a=@ .^(a)) ~] ,~)
354− ~
355− ~zod/try=> (mang [|=(a=@ .^(a)) ~] ,[~ %42])
356− [~ 42]
357− ~zod/try=> (mang [|=(a=@ .^(a)) ~] |=(a=* [~ a 6]))
358− [~ [0 6]]
359− ~zod/try=> (mang [|=(a=@ .^(a)) 8] |=(a=* [~ a 6]))
360− [~ [8 6]]
361−
362------------------------------------------------------------------------
12------------------------------------------------------------------------
363
13
364−### `++mong`
365−
366−Slam gate with sample
367−
368−Produces a [`++toon`]() computation result from slamming `gat` with
369−`sam`, using `sky` to compute or block on nock 11 when applicable.
370−
371−Accepts
372−-------
373−
374−`gat` is a [noun]() that is generally a [`gate`]().
375−
376−`sam` is a [`sample`]() noun.
377−
378−`sky` is an [%iron]() gate invoked with [nock operator 11]().
379−
380−Produces
381−--------
382−
383−A `++toon`.
384−
385−Source
386−------
387−
388− ++ mong
389− |= [[gat=* sam=*] sky=$+(* (unit))]
390− ^- toon
391− ?. &(?=(^ gat) ?=(^ +.gat))
392− [%2 ~]
393− (mock [[-.gat [sam +>.gat]] -.gat] sky)
394− ::
395−
396−Examples
397−--------
398−
399− ~zod/try=> (mong [|=(@ 20) ~] ,~)
400− [%0 p=20]
401− ~zod/try=> (mong [|=(@ !!) ~] ,~)
402− [%2 p=~]
403− ~zod/try=> (mong [|=(a=@ (add 20 a)) ~] ,~)
404− [%0 p=20]
405− ~zod/try=> (mong [|=(a=[@ @] (add 20 -.a)) ~] ,~)
406− [%2 p=~]
407− ~zod/try=> (mong [|=(a=[@ @] (add 20 -.a)) [4 6]] ,~)
408− [%0 p=24]
409− ~zod/try=> (mong [|=(a=@ .^(a)) ~] ,~)
410− [%1 p=~[0]]
411− ~zod/try=> (mong [|=(a=@ .^(a)) ~] ,[~ %42])
412− [%0 p=42]
413− ~zod/try=> (mong [|=(a=@ .^(a)) ~] |=(a=* [~ a 6]))
414− [%0 p=[0 6]]
415− ~zod/try=> (mong [|=(a=@ .^(a)) 8] |=(a=* [~ a 6]))
416− [%0 p=[8 6]]
417−
418------------------------------------------------------------------------
14------------------------------------------------------------------------
419
15
420### `++mung`
16### `++mung`
docs/system/hoon/library/2ep.md−809
@@ -1,809 +0,0 @@
1−2eP diff
2−========
3−
4−A- more or less low priority and/or currently in the wrong section
5−anyway.
6−
7−------------------------------------------------------------------------
8−
9−------------------------------------------------------------------------
10−
11−### `++berk`
12−
13−Invert diff patches
14−
15−Inverts a list of changes `bur`. Skips stay constant and replaces are
16−swapped. Produces a `bur`.
17−
18−Accepts
19−-------
20−
21−`bur` is a [`++urge`]().
22−
23−Produces
24−--------
25−
26−The `++urge` of a noun.
27−
28−Source
29−------
30−
31− ++ berk :: invert diff patch
32− |* bur=(urge)
33− |- ^+ bur
34− ?~ bur ~
35− :_ $(bur t.bur)
36− ?- -.i.bur
37− & i.bur
38− | [%| q.i.bur p.i.bur]
39− ==
40− ::
41−
42−Examples
43−--------
44−
45− ~zod/try=> (berk `(urge)`~[`10 %|^[~[2] ~[3 4]] `5])
46− ~[[%.y p=10] [%.n p=~[3 4] q=~[2]] [%.y p=5]]
47− ~zod/try=> (lurk "somes" `(urge char)`~[`1 [%| "o" "a"] `3])
48− "sames"
49− ~zod/try=> (berk `(urge char)`~[`1 [%| "o" "a"] `3])
50− ~[[%.y p=1] [%.n p="a" q="o"] [%.y p=3]]
51− ~zod/try=> (lurk "sames" (berk `(urge char)`~[`1 [%| "o" "a"] `3]))
52− "somes"
53−
54−------------------------------------------------------------------------
55−
56−### `++diff`
57−
58−Generate patch
59−
60−Produces a patch between two nouns, by change type
61−
62−Accepts
63−-------
64−
65−`pum` is an [`++umph`]().
66−
67−Produces
68−--------
69−
70−An [`++udon`]()
71−
72−Source
73−------
74−
75− ++ diff :: generate patch
76− |= pum=umph
77− |= [old=* new=*] ^- udon
78− :- pum
79− ?+ pum ~|(%unsupported !!)
80− %a [%d (nude old new)]
81− %b =+ [hel=(cue ((hard ,@) old)) hev=(cue ((hard ,@) new))]
82− [%d (nude hel hev)]
83− %c =+ [hel=(lore ((hard ,@) old)) hev=(lore ((hard ,@) new))]
84− [%c (lusk hel hev (loss hel hev))]
85− ==
86− ::
87−
88−Examples
89−--------
90−
91− ~zod/try=> ((diff %a) 20 21)
92− [p=%a q=[%d p=[%1 p=21] q=[%1 p=20]]]
93− ~zod/try=> ((diff %a) [1 2 3] [1 2 4])
94− [ p=%a
95− q
96− [ %d
97− p=[p=[%0 p=2] q=[p=[%0 p=6] q=[%1 p=4]]]
98− q=[p=[%0 p=2] q=[p=[%0 p=6] q=[%1 p=3]]]
99− ]
100− ]
101− ~zod/try=> ~04hh
102− [1 2]
103− ~zod/try=> ~0ph
104− [1 1]
105− ~zod/try=> ((diff %b) 0v4hh 0vph)
106− [p=%b q=[%d p=[p=[%0 p=2] q=[%0 p=2]] q=[p=[%0 p=3] q=[%1 p=2]]]]
107− ~zod/try=> ((diff %c) (role 'sam' 'les' 'les' 'kor' ~) (role 'sam' 'mor' 'kor' ~))
108− [p=%c q=[%c p=~[[%.y p=1] [%.n p=~[7.562.604 7.562.604] q=~[7.499.629]] [%.y p=1]]]]
109− ~[[%.y p=0] [%.y p=0] [%.y p=1] [%.n p=<|les les|> q=<|mor|>] [%.y p=1]]
110− ~zod/try=> (,[%c %c (urge cord)] ((diff %c) (role 'sam' 'les' 'les' 'kor' ~) (role 'sam' 'mor' 'kor' ~)))
111− [%c %c ~[[%.y p=1] [%.n p=<|les les|> q=<|mor|>] [%.y p=1]]]
112−
113−------------------------------------------------------------------------
114−
115−### `++loss`
116−
117−Longest subsequence
118−
119−Finds a subsequence of repeated elements within two [`++list`]()s, using
120−several internal helper arms. Produces a [`++tape`]().
121−
122−Accepts
123−-------
124−
125−`hel` is a [`++list`]() of [nouns]().
126−
127−`hev` is a [++list`]() of nouns.
128−
129−Produces
130−--------
131−
132−XX
133−
134−A [++list`]() of nouns.
135−
136−Source
137−------
138−
139− ++ loss :: longest subsequence
140− ~/ %loss
141− |* [hel=(list) hev=(list)]
142− |- ^+ hev
143− =+ ^= sev
144− =+ [inx=0 sev=*(map ,@t (list ,@ud))]
145− |- ^+ sev
146− ?~ hev sev
147− =+ guy=(~(get by sev) i.hev)
148− $(hev t.hev, inx +(inx), sev (~(put by sev) i.hev [inx ?~(guy ~ u.guy)]))
149− =| gox=[p=@ud q=(map ,@ud ,[p=@ud q=_hev])]
150− =< abet
151− =< main
152− |%
153− ++ abet =.(q.rag ?:(=([& 0] p.rag) q.rag [p.rag q.rag]) (flop q.rag))
154− ++ hink :: extend fits top
155− |= [inx=@ud goy=@ud] ^- ?
156− |(=(p.gox inx) (lth goy p:(need (~(get by q.gox) inx))))
157− ::
158− ++ lonk :: extend fits bottom
159− |= [inx=@ud goy=@ud] ^- ?
160− |(=(0 inx) (gth goy p:(need (~(get by q.gox) (dec inx)))))
161− ::
162− ++ lune :: extend
163− |= [inx=@ud goy=@ud]
164− ^+ +>
165− %_ +>.$
166− gox
167− :- ?:(=(inx p.gox) +(p.gox) p.gox)
168− %+ ~(put by q.gox) inx
169− [goy (snag goy hev) ?:(=(0 inx) ~ q:(need (~(get by q.gox) (dec inx))))]
170− ==
171− ::
172− ++ merg :: merge all matches
173− |= gay=(list ,@ud)
174− ^+ +>
175− =+ ^= zes
176− =+ [inx=0 zes=*(list ,[p=@ud q=@ud])]
177− |- ^+ zes
178− ?: |(?=(~ gay) (gth inx p.gox)) zes
179− ?. (lonk inx i.gay) $(gay t.gay)
180− ?. (hink inx i.gay) $(inx +(inx))
181− $(inx +(inx), gay t.gay, zes [[inx i.gay] zes])
182− |- ^+ +>.^$
183− ?~(zes +>.^$ $(zes t.zes, +>.^$ (lune i.zes)))
184− ::
185− ++ main
186− |- ^+ +
187− ?~ hel
188− ?~ hev
189− ?>(?=(~ lcs) +)
190− $(hev t.hev, rag (done %| ~ [i.hev ~]))
191− ?~ hev
192− $(hel t.hel, rag (done %| [i.hel ~] ~))
193− ?~ lcs
194− +(rag (done %| (flop hel) (flop hev)))
195− ?: =(i.hel i.lcs)
196− ?: =(i.hev i.lcs)
197− $(lcs t.lcs, hel t.hel, hev t.hev, rag (done %& 1))
198− $(hev t.hev, rag (done %| ~ [i.hev ~]))
199− ?: =(i.hev i.lcs)
200− $(hel t.hel, rag (done %| [i.hel ~] ~))
201− $(hel t.hel, hev t.hev, rag (done %| [i.hel ~] [i.hev ~]))
202− --
203−
204−Examples
205−--------
206−
207− ~zod/try=> (loss "sam" "sem")
208− "sm"
209− ~zod/try=> (loss "samo" "semo")
210− "smo"
211− ~zod/try=> (loss "sakmo" "semo")
212− "smo"
213− ~zod/try=> (loss "ferdinham" "ferdilapos
214− ~ <syntax error at [1 30]>
215− ~zod/try=> (loss "ferdinham" "ferdilapos")
216− "ferdia"
217−
218−------------------------------------------------------------------------
219−
220−### `++locz`
221−
222−Find common
223−
224−Finds a subsequence of repeated elements within two
225−[`++list`](/doc/hoon/library/1#++list)s, producing a [\`++tape]().
226−
227−Accepts
228−-------
229−
230−A cell of two `++tape`s, `hel` and `hev`.
231−
232−Produces
233−--------
234−
235−A `++tape`.
236−
237−Source
238−------
239−
240− ++ locz :: trivial algorithm
241− |= [hel=tape hev=tape]
242− ^- tape
243− =+ [leh=(lent hel) veh=(lent hev)]
244− =- (flop q.yun)
245− ^= yun
246− |- ^- [p=@ud q=tape]
247− ~+
248− ?: |(=(0 leh) =(0 veh)) [0 ~]
249− =+ [dis=(snag (dec leh) hel) dat=(snag (dec veh) hev)]
250− ?: =(dis dat)
251− =+ say=$(leh (dec leh), veh (dec veh))
252− [+(p.say) [dis q.say]]
253− =+ [lef=$(leh (dec leh)) rig=$(veh (dec veh))]
254− ?:((gth p.lef p.rig) lef rig)
255− ::
256−
257−Examples
258−--------
259−
260− ~zod/try=> (locz "samukot" "semelkot")
261− "smkot"
262− ~zod/try=> (locz "samukot" "samelkot")
263− "samkot"
264−
265−------------------------------------------------------------------------
266−
267−### `++lore`
268−
269−Split on `\n`
270−
271−Split on newlines, ascii `10`
272−
273−Accepts
274−-------
275−
276−`lub` is an atom.
277−
278−Produces
279−--------
280−
281−XX
282−
283−A `++list` of atoms of odor [`@t`]() ([`++cord`]()).
284−
285−Source
286−------
287− ++ lore :: atom to line list
288− ~/ %lore
289− |= lub=@
290− =| tez=(list ,@t)
291− |- ^+ tez
292− ?: =(0 lub) (flop tez)
293− =+ ^= meg
294− =+ meg=0
295− |- ^- @ud
296− =+ gam=(cut 3 [meg 1] lub)
297− ?:(|(=(10 gam) =(0 gam)) meg $(meg +(meg)))
298− =+ res=(rsh 3 +(meg) lub)
299− ?: &(=(0 (cut 3 [meg 1] lub)) !=(0 res))
300− !!
301− $(lub res, tez [(end 3 meg lub) tez])
302− ::
303−
304−Examples
305−--------
306−
307− ~zod/try=> (lore 'soke\0alas\0amep')
308− <|soke las mep|>
309− ~zod/try=> (lore '|= a=@\0a=+ b=(add a 5)\0a(mix b a)')
310− <||= a=@ =+ b=(add a 5) (mix b a)|>
311− ~zod/try=> `wain`[(fil 3 80 ' ') (lore '|= a=@\0a=+ b=(add a 5)\0a(mix b a)')]
312− <|
313− |= a=@
314− =+ b=(add a 5)
315− (mix b a)
316− |>
317−
318−------------------------------------------------------------------------
319−
320−### `++role`
321−
322−Join with `\n`
323−
324−Join line list with newlines.
325−
326−Accepts
327−-------
328−
329−A `++list` of atoms of [odor]() [`@t`]() ([`++cord`]()).
330−
331−Produces
332−--------
333−
334−XX
335−
336−An atom of [odor]() [`@t`]() ([`++cord`]().
337−
338−Source
339−------
340−
341− ++ role :: line list to atom
342− |= tez=(list ,@t)
343− (rap 3 (turn tez |=(a=@t (cat 3 a 10))))
344− ::
345−
346−Examples
347−--------
348−
349− ~zod/try=> (role 'sep' 'tek' 'lap' ~)
350− 3.230.709.852.558.292.782.985.274.739
351− ~zod/try=> `@t`(role 'sep' 'tek' 'lap' ~)
352− '''
353− sep
354− tek
355− lap
356− '''
357−
358−------------------------------------------------------------------------
359−
360−### `++lump`
361−
362−Change with `++udon`
363−
364−Use [`++udon`]() to change [noun]().
365−
366−Accepts
367−-------
368−
369−A cell of an `++udon`, `don`, and a noun, `src`.
370−
371−Produces
372−--------
373−
374−A noun.
375−
376−Source
377−------
378−
379− ++ lump :: apply patch
380− |= [don=udon src=*]
381− ^- *
382− ?+ p.don ~|(%unsupported !!)
383− %a
384− ?+ -.q.don ~|(%unsupported !!)
385− %a q.q.don
386− %c (lurk ((hard (list)) src) p.q.don)
387− %d (lure src p.q.don)
388− ==
389− ::
390− %c
391− =+ dst=(lore ((hard ,@) src))
392− %- role
393− ?+ -.q.don ~|(%unsupported !!)
394− %a ((hard (list ,@t)) q.q.don)
395− %c (lurk dst p.q.don)
396− ==
397− ==
398− ::
399−
400−Examples
401−--------
402−
403− ~zod/try=> (lump [%a %a 20 25] 20)
404− 25
405− ~zod/try=> (lump [%a %d [[%0 1] [%0 1]] [%0 2]] 20)
406− [20 20]
407− ~zod/try=> (lump [%c %a ~['sa' 'le'] ~['sa' 'lo']] 'sa\0ale')
408− 11.473.670.267.251
409− ~zod/try=> (,@t (lump [%c %a ~['sa' 'le'] ~['sa' 'lo']] 'sa\0ale'))
410− '''
411− sa
412− lo
413− '''
414− ~zod/try=> (,@t (lump [%c %c `1 [%| ~['le'] ~['lo' 'ma']] ~] 'sa\0ale'))
415− '''
416− sa
417− ma
418− lo
419− '''
420−
421−------------------------------------------------------------------------
422−
423−### `++lure`
424−
425−Patch `a`
426−
427−Patch a by references to axis and literal.
428−
429−Accepts
430−-------
431−
432−A cell of a [noun](), `a`, and an [`++upas`](), `b`.
433−
434−Produces
435−--------
436−
437−A noun.
438−
439−Source
440−------
441−
442− ++ lure :: apply tree diff
443− |= [a=* b=upas]
444− ^- *
445− ?^ -.b
446− [$(b -.b) $(b +.b)]
447− ?+ -.b ~|(%unsupported !!)
448− %0 .*(a [0 p.b])
449− %1 .*(a [1 p.b])
450− ==
451−
452−Examples
453−--------
454−
455− ~zod/try=> (lure ~[1 2] [[%0 2] [%1 3] [%0 7]])
456− [1 3 0]
457− ~zod/try=> (lure ~[1 2 4] [[%0 2] [%1 3] [%0 7]])
458− [1 3 4 0]
459−
460−------------------------------------------------------------------------
461−
462−### `++limp`
463−
464−Reverse patch
465−
466−Reverse a patch (preprocessor unchanged)
467−
468−Accepts
469−-------
470−
471−`don` is an [`++udon`]().
472−
473−Produces
474−--------
475−
476−An `++udon`.
477−
478−Source
479−------
480−
481− ++ limp :: invert patch
482− |= don=udon ^- udon
483− :- p.don
484− ?+ -.q.don ~|(%unsupported !!)
485− %a [%a q.q.don p.q.don]
486− %c [%c (berk p.q.don)]
487− %d [%d q.q.don p.q.don]
488− ==
489− ::
490−
491−Examples
492−--------
493−
494− ~zod/try=> (limp [%a %a 20 40])
495− [p=%a q=[%a p=40 q=20]]
496− ~zod/try=> (limp [%c %c ~[`20 [%| ~[52 53] ~[51]] `6]])
497− [p=%c q=[%c p=~[[%.y p=20] [%.n p=~[51] q=~[52 53]] [%.y p=6]]]]
498− ~zod/try=> (limp [%a %d [[%0 1] [%0 1]] [%0 2]])
499− [p=%a q=[%d p=[%0 p=2] q=[p=[%0 p=1] q=[%0 p=1]]]]
500−
501−------------------------------------------------------------------------
502−
503−### `++hump`
504−
505−Prep for diff
506−
507−Prep atom for diff: leave alone, cue, or split by newlines.
508−
509−Accepts
510−-------
511−
512−A cell of an [`++umph`](), `pum`, and a [noun](), `src`.
513−
514−Produces
515−--------
516−
517−A noun.
518−
519−Source
520−------
521−
522− ++ hump :: general prepatch
523− |= [pum=umph src=*] ^- *
524− ?+ pum ~|(%unsupported !!)
525− %a src
526− %b (cue ((hard ,@) src))
527− %c (lore ((hard ,@) src))
528− ==
529− ::
530−
531−Examples
532−--------
533−
534− ~zod/try=> (hump %a ~)
535− 0
536− ~zod/try=> (hump %a 40)
537− 40
538− ~zod/try=> (hump %c 40)
539− [40 0]
540− ~zod/try=> (hump %c 'as')
541− [29.537 0]
542− ~zod/try=> (hump %c 'as\0alok')
543− [29.537 7.040.876 0]
544− ~zod/try=> (hump %b 0vph)
545− [1 1]
546−
547−------------------------------------------------------------------------
548−
549−### `++husk`
550−
551−Atomize post diff
552−
553−Re-atomize after diff: leave alone, jam, or join with newlines.
554−
555−Accepts
556−-------
557−
558−A cell of an [`++umph`](), `pum`, and a [noun](), `dst`.
559−
560−Produces
561−--------
562−
563−A noun.
564−
565−Source
566−------
567−
568− ++ husk :: unprepatch
569− |= [pum=umph dst=*] ^- *
570− ?+ pum ~|(%unsupported !!)
571− %a dst
572− %b (jam dst)
573− %c (role ((hard (list ,@)) dst))
574− ==
575− ::
576−
577−Examples
578−--------
579−
580− ~zod/try=> (husk %a 0)
581− 0
582− ~zod/try=> (husk %a 40)
583− 40
584− ~zod/try=> (husk %c [40 0])
585− 2.600
586− ~zod/try=> (rip 3 (,@ (husk %c [40 0])))
587− ~[40 10]
588− ~zod/try=> (husk %c [%as 0])
589− 684.897
590− ~zod/try=> (husk %c [%as 0])
591− 684.897
592− ~zod/try=> (,@t (husk %c [%as 0]))
593− '''
594− as
595− '''
596− ~zod/try=> (husk %c [%as %lok 0])
597− 2.932.876.065.272.673
598− ~zod/try=> (,@t (husk %c [%as %lok 0]))
599− '''
600− as
601− lok
602− '''
603− ~zod/try=> (husk %b [1 1])
604− 817
605− ~zod/try=> (,@uv (husk %b [1 1]))
606− 0vph
607− ~zod/try=> ~0ph
608− [1 1]
609−
610−------------------------------------------------------------------------
611−
612−### `++lurk`
613−
614−Apply list patch
615−
616−Amend list using an urge: [`++list`]() of `[%& {number skipped}]` and
617−`[%| old new]`
618−
619−
620−Accepts
621−-------
622−
623−A cell of a `++list` of [noun]()s, `hel`, and an [`++urge`]() of a noun, `rug`.
624−
625−Produces
626−--------
627−
628−A `++list` of nouns.
629−
630−Source
631−------
632−
633− ++ lurk :: apply list patch
634− |* [hel=(list) rug=(urge)]
635− ^+ hel
636− =+ war=`_hel`~
637− |- ^+ hel
638− ?~ rug (flop war)
639− ?- -.i.rug
640− &
641− %= $
642− rug t.rug
643− hel (slag p.i.rug hel)
644− war (weld (flop (scag p.i.rug hel)) war)
645− ==
646− ::
647− |
648− %= $
649− rug t.rug
650− hel =+ gur=(flop p.i.rug)
651− |- ^+ hel
652− ?~ gur hel
653− ?>(&(?=(^ hel) =(i.gur i.hel)) $(hel t.hel, gur t.gur))
654− war (weld q.i.rug war)
655− ==
656− ==
657− ::
658−
659−Examples
660−--------
661−
662− ~zod/try=> (lurk "hema" `(urge char)`~[`1 [%| "e" "ru"] `2])
663− "hurma"
664− ~zod/try=> (lurk "koltep" `(urge char)`~[`3 [%| "et" ""] `1])
665− "kolp"
666−
667−------------------------------------------------------------------------
668−
669−### `++lusk`
670−
671−`lcs` to list patch
672−
673−Using a common sequence, generate urge from two [`++list`]()s.
674−
675−
676−Accepts
677−-------
678−
679−A cell of three `++list`s of [noun](), `hel`, `hev`, and `lcs`.
680−
681−Produces
682−--------
683−
684−Source
685−------
686−
687− ++ lusk :: lcs to list patch
688− |* [hel=(list) hev=(list) lcs=(list)]
689− =+ ^= rag
690− ^- $% [& p=@ud]
691− [| p=_lcs q=_lcs]
692− ==
693− [%& 0]
694− => .(rag [p=rag q=*(list ,_rag)])
695− =< abet =< main
696− |%
697− ++ abet =.(q.rag ?:(=([& 0] p.rag) q.rag [p.rag q.rag]) (flop q.rag))
698− ++ done
699− |= new=_p.rag
700− ^+ rag
701− ?- -.p.rag
702− | ?- -.new
703− | [[%| (weld p.new p.p.rag) (weld q.new q.p.rag)] q.rag]
704− & [new [p.rag q.rag]]
705− ==
706− & ?- -.new
707− | [new ?:(=(0 p.p.rag) q.rag [p.rag q.rag])]
708− & [[%& (add p.p.rag p.new)] q.rag]
709− ==
710− ==
711− ::
712− ++ main
713− |- ^+ +
714− ?~ hel
715− ?~ hev
716− ?>(?=(~ lcs) +)
717− $(hev t.hev, rag (done %| ~ [i.hev ~]))
718− ?~ hev
719− $(hel t.hel, rag (done %| [i.hel ~] ~))
720− ?~ lcs
721− +(rag (done %| (flop hel) (flop hev)))
722− ?: =(i.hel i.lcs)
723− ?: =(i.hev i.lcs)
724− $(lcs t.lcs, hel t.hel, hev t.hev, rag (done %& 1))
725− $(hev t.hev, rag (done %| ~ [i.hev ~]))
726− ?: =(i.hev i.lcs)
727− $(hel t.hel, rag (done %| [i.hel ~] ~))
728− $(hel t.hel, hev t.hev, rag (done %| [i.hel ~] [i.hev ~]))
729− --
730−
731−Examples
732−--------
733−
734− ~zod/try=> (lusk "hamok" "hasok" "haok")
735− ~[[%.y p=2] [%.n p="m" q="s"] [%.y p=2]]
736− ~zod/try=> (lusk "hamok" "hasok" "hak")
737− ~[[%.y p=2] [%.n p="om" q="os"] [%.y p=1]]
738− ~zod/try=> (lusk "telroga" "tesomga" "teoga")
739− ~[[%.y p=2] [%.n p="rl" q="s"] [%.y p=1] [%.n p="" q="m"] [%.y p=2]]
740− ~zod/try=> (lurk "telroga" `(urge char)`~[[%.y p=2] [%.n p="rl" q="s"] [%.y p=1] [%.n p="" q="m"] [%.y p=2]])
741− "tesomga"
742−
743−------------------------------------------------------------------------
744−
745−### `++nude`
746−
747−Tree change
748−
749−Generate tree diff from two nouns.
750−
751−Accepts
752−-------
753−
754−A cell of two nouns, `a` and `b`.
755−
756−Produces
757−--------
758−
759−A cell of two [`++upas`](), `p` and `q`.
760−
761−Source
762−------
763−
764− ++ nude :: tree change
765− |= [a=* b=*]
766− ^- [p=upas q=upas]
767− =< [p=(tred a b) q=(tred b a)]
768− |%
769− ++ axes :: locs of nouns
770− |= [a=@ b=*] ^- (map ,* axis)
771− =+ c=*(map ,* axis)
772− |- ^- (map ,* axis)
773− => .(c (~(put by c) b a))
774− ?@ b
775− c
776− %- ~(uni by c)
777− %- ~(uni by $(a (mul 2 a), b -.b))
778− $(a +((mul 2 a)), b +.b)
779− ::
780− ++ tred :: diff a->b
781− |= [a=* b=*] ^- upas
782− =| c=(unit ,*)
783− =+ d=(axes 1 a)
784− |- ^- upas
785− => .(c (~(get by d) b))
786− ?~ c
787− ?@ b
788− [%1 b]
789− =+ e=^-(upas [$(b -.b) $(b +.b)])
790− ?- e
791− [[%1 *] [%1 *]] [%1 [p.p.e p.q.e]]
792− * e
793− ==
794− [%0 u.c]
795− --
796−
797−Examples
798−--------
799−
800− ~zod/try=> (nude 40 20)
801− [p=[%1 p=20] q=[%1 p=40]]
802− ~zod/try=> (nude [5 5] 5)
803− [p=[%0 p=3] q=[p=[%0 p=1] q=[%0 p=1]]]
804− ~zod/try=> (nude "sam" "sal")
805− [ p=[p=[%1 p=115] q=[p=[%1 p=97] q=[p=[%1 p=108] q=[%0 p=15]]]]
806− q=[p=[%1 p=115] q=[p=[%1 p=97] q=[p=[%1 p=109] q=[%0 p=15]]]]
807− ]
808−
809−------------------------------------------------------------------------
docs/system/hoon/library/2ew.md−436
@@ -1,439 +1,3 @@
12eW lite number theory
12eW lite number theory
2======================
2======================
3
3
4−### `++egcd`
5−
6−GCD
7−
8− ++ egcd :: schneier's egcd
9− |= [a=@ b=@]
10− =+ si
11− =+ [c=(sun a) d=(sun b)]
12− =+ [u=[c=(sun 1) d=--0] v=[c=--0 d=(sun 1)]]
13− |- ^- [d=@ u=@ v=@]
14− ?: =(--0 c)
15− [(abs d) d.u d.v]
16− :: ?> ?& =(c (sum (pro (sun a) c.u) (pro (sun b) c.v)))
17− :: =(d (sum (pro (sun a) d.u) (pro (sun b) d.v)))
18− :: ==
19− =+ q=(fra d c)
20− %= $
21− c (dif d (pro q c))
22− d c
23− u [(dif d.u (pro q c.u)) c.u]
24− v [(dif d.v (pro q c.v)) c.v]
25− ==
26− ::
27−
28−Greatest common denominator
29−
30− ~zod/try=> (egcd 20 15)
31− [d=5 u=2 v=1]
32− ~zod/try=> (egcd 24 16)
33− [d=8 u=2 v=1]
34− ~zod/try=> (egcd 7 5)
35− [d=1 u=3 v=6]
36− ~zod/try=> (egcd (shaf ~ %ham) (shaf ~ %sam))
37− [ d=1
38− u=59.983.396.314.566.203.239.184.568.129.921.874.787
39− v=38.716.650.351.034.402.960.165.718.823.532.275.722
40− ]
41−
42−------------------------------------------------------------------------
43−
44−### `++pram`
45−
46−Probable prime
47−
48− ++ pram :: rabin-miller
49− |= a=@ ^- ?
50− ?: ?| =(0 (end 0 1 a))
51− =(1 a)
52− =+ b=1
53− |- ^- ?
54− ?: =(512 b)
55− |
56− ?|(=+(c=+((mul 2 b)) &(!=(a c) =(a (mul c (div a c))))) $(b +(b)))
57− ==
58− |
59− =+ ^= b
60− =+ [s=(dec a) t=0]
61− |- ^- [s=@ t=@]
62− ?: =(0 (end 0 1 s))
63− $(s (rsh 0 1 s), t +(t))
64− [s t]
65− ?> =((mul s.b (bex t.b)) (dec a))
66− =+ c=0
67− |- ^- ?
68− ?: =(c 64)
69− &
70− =+ d=(~(raw og (add c a)) (met 0 a))
71− =+ e=(~(exp fo a) s.b d)
72− ?& ?| =(1 e)
73− =+ f=0
74− |- ^- ?
75− ?: =(e (dec a))
76− &
77− ?: =(f (dec t.b))
78− |
79− $(e (~(pro fo a) e e), f +(f))
80− ==
81− $(c +(c))
82− ==
83− ::
84−
85−Probable prime test
86−
87− ~zod/try=> (pram 31)
88− %.y
89− ~zod/try=> =+(a=2 |-(?:(=(a 31) ~ [i=(mod 31 a) t=$(a +(a))])))
90− ~[1 1 3 1 1 3 7 4 1 9 7 5 3 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1]
91− ~zod/try=> =+(a=2 |-(?:(=(a 31) ~ [i=(mod 30 a) t=$(a +(a))])))
92− ~[0 0 2 0 0 2 6 3 0 8 6 4 2 0 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0]
93− ~zod/try=> (pram 256)
94− %.n
95− ~zod/try=> (pram (dec (bex 127)))
96− %.y
97−
98−------------------------------------------------------------------------
99−
100−### `++ramp`
101−
102−`r-m` prime
103−
104− ++ ramp :: make r-m prime
105− |= [a=@ b=(list ,@) c=@] ^- @ux :: [bits snags seed]
106− => .(c (shas %ramp c))
107− =+ d=_@
108− |-
109− ?: =((mul 100 a) d)
110− ~|(%ar-ramp !!)
111− =+ e=(~(raw og c) a)
112− ?: &((levy b |=(f=@ !=(1 (mod e f)))) (pram e))
113− e
114− $(c +(c), d (shax d))
115− ::
116−
117−Random `a` bit prime, which isn't 1 modulo a list of other numbers,
118−using salt `c`.
119−
120− ~zod/try=> (ramp 20 ~ %hamelok)
121− 0xf.1f0d
122− ~zod/try=> (ramp 20 ~ %hameloe)
123− 0x2.d341
124− ~zod/try=> (ramp 5 ~ %kole)
125− 0x1f
126− ~zod/try=> (ramp 7 ~ %kole)
127− 0x4f
128− ~zod/try=> (ramp 7 ~[0x4e] %kole)
129− 0x43
130− ~zod/try=> `@uw`(ramp 128 ~ %late)
131− 0w3y.irKIL.l-pp1.2CkG4.3lsTF
132−
133−------------------------------------------------------------------------
134−
135−### `++fo`
136−
137−Prime engine
138−
139− ++ fo :: modulo prime
140− |_ a=@
141−
142−XX DO NOT RERUN GET.LS, THERE EXIST ARM COLLISIONS
143−
144−Core for performing arithmetic modulo a prime number
145−
146− ~zod/try=> ~(. fo 79)
147− <7.get [@ud <373.jdd 100.kzl 1.ypj %164>]>
148−
149−------------------------------------------------------------------------
150−
151−### `++dif`
152−
153−Difference
154−
155− ++ dif
156− |= [b=@ c=@]
157− (sit (sub (add a b) (sit c)))
158− ::
159−
160−Subtract
161−
162− ~zod/try=> (~(dif fo 79) 10 5)
163− 5
164− ~zod/try=> (~(dif fo 79) 5 10)
165− 74
166−
167−------------------------------------------------------------------------
168−
169−### `++exp`
170−
171−Exponent
172−
173− ++ exp
174− |= [b=@ c=@]
175− ?: =(0 b)
176− 1
177− =+ d=$(b (rsh 0 1 b))
178− =+ e=(pro d d)
179− ?:(=(0 (end 0 1 b)) e (pro c e))
180− ::
181−
182−Exponent
183−
184− ~zod/try=> (~(exp fo 79) 3 5)
185− 46
186−
187−------------------------------------------------------------------------
188−
189−### `++fra`
190−
191−Divide
192−
193− ++ fra
194− |= [b=@ c=@]
195− (pro b (inv c))
196− ::
197−
198−Divide
199−
200− ~zod/try=> (~(fra fo 79) 20 4)
201− 5
202− ~zod/try=> (~(fra fo 79) 7 11)
203− 15
204−
205−------------------------------------------------------------------------
206−
207−### `++inv`
208−
209−Inverse
210−
211− ++ inv
212− |= b=@
213− =+ c=(dul:si u:(egcd b a) a)
214− c
215− ::
216−
217−Multiplicative inverse
218−
219− ~zod/try=> (~(inv fo 79) 12)
220− 33
221− ~zod/try=> (~(pro fo 79) 12 33)
222− 1
223− ~zod/try=> (~(inv fo 79) 0)
224− 0
225−
226−------------------------------------------------------------------------
227−
228−### `++pro`
229−
230−Product
231−
232− ++ pro
233− |= [b=@ c=@]
234− (sit (mul b c))
235− ::
236−
237−Product
238−
239− ~zod/try=> (~(pro fo 79) 5 10)
240− 50
241− ~zod/try=> (~(pro fo 79) 5 20)
242− 21
243−
244−------------------------------------------------------------------------
245−
246−### `++sit`
247−
248−Bounds
249−
250− ++ sit
251− |= b=@
252− (mod b a)
253− ::
254−
255−Bounds check
256−
257− ~zod/try=> (~(sit fo 79) 9)
258− 9
259− ~zod/try=> (~(sit fo 79) 99)
260− 20
261−
262−------------------------------------------------------------------------
263−
264−### `++sum`
265−
266−Sum
267−
268− ++ sum
269− |= [b=@ c=@]
270− (sit (add b c))
271− --
272−
273−Add
274−
275− ~zod/try=> (~(sum fo 79) 9 9)
276− 18
277− ~zod/try=> (~(sum fo 79) 70 9)
278− 0
279−
280−------------------------------------------------------------------------
281−
282−### `++ga`
283−
284− ++ ga :: GF (bex p.a)
285− |= a=[p=@ q=@ r=@] :: dim poly gen
286− =+ si=(bex p.a)
287− =+ ma=(dec si)
288− => |%
289−
290−RSA internals
291−
292−XX document
293−
294−------------------------------------------------------------------------
295−
296−### `++dif`
297−
298− ++ dif :: add and sub
299− |= [b=@ c=@]
300− ~| [%dif-ga a]
301− ?> &((lth b si) (lth c si))
302− (mix b c)
303− ::
304−
305−XX document
306−
307−------------------------------------------------------------------------
308−
309−### `++dub`
310−
311− ++ dub :: mul by x
312− |= b=@
313− ~| [%dub-ga a]
314− ?> (lth b si)
315− ?: =(1 (cut 0 [(dec p.a) 1] b))
316− (dif (sit q.a) (sit (lsh 0 1 b)))
317− (lsh 0 1 b)
318− ::
319−
320−XX document
321−
322−------------------------------------------------------------------------
323−
324−### `++pro`
325−
326− ++ pro :: slow multiply
327− |= [b=@ c=@]
328− ?: =(0 b)
329− 0
330− ?: =(1 (dis 1 b))
331− (dif c $(b (rsh 0 1 b), c (dub c)))
332− $(b (rsh 0 1 b), c (dub c))
333− ::
334−
335−XX document
336−
337−------------------------------------------------------------------------
338−
339−### `++toe`
340−
341− ++ toe :: exp/log tables
342− =+ ^= nu
343− |= [b=@ c=@]
344− ^- (map ,@ ,@)
345− =+ d=*(map ,@ ,@)
346− |-
347− ?: =(0 c)
348− d
349− %= $
350− c (dec c)
351− d (~(put by d) c b)
352− ==
353− =+ [p=(nu 0 (bex p.a)) q=(nu ma ma)]
354− =+ [b=1 c=0]
355− |- ^- [p=(map ,@ ,@) q=(map ,@ ,@)]
356− ?: =(ma c)
357− [(~(put by p) c b) q]
358− %= $
359− b (pro r.a b)
360− c +(c)
361− p (~(put by p) c b)
362− q (~(put by q) b c)
363− ==
364− ::
365−
366−XX document
367−
368−------------------------------------------------------------------------
369−
370−### `++sit`
371−
372− ++ sit :: reduce
373− |= b=@
374− (mod b (bex p.a))
375− --
376−
377−XX document
378−
379−------------------------------------------------------------------------
380−
381−### `++fra`
382−
383− ++ fra :: divide
384− |= [b=@ c=@]
385− (pro b (inv c))
386− ::
387−
388−XX document
389−
390−------------------------------------------------------------------------
391−
392−### `++inv`
393−
394− ++ inv :: invert
395− |= b=@
396− ~| [%inv-ga a]
397− =+ c=(~(get by q) b)
398− ?~ c !!
399− =+ d=(~(get by p) (sub ma u.c))
400− (need d)
401− ::
402−
403−XX document
404−
405−------------------------------------------------------------------------
406−
407−### `++pow`
408−
409− ++ pow :: exponent
410− |= [b=@ c=@]
411− =+ [d=1 e=c f=0]
412− |-
413− ?: =(p.a f)
414− d
415− ?: =(1 (cut 0 [f 1] b))
416− $(d (pro d e), e (pro e e), f +(f))
417− $(e (pro e e), f +(f))
418− ::
419−
420−XX document
421−
422−------------------------------------------------------------------------
423−
424−### `++pro`
425−
426− ++ pro :: multiply
427− |= [b=@ c=@]
428− ~| [%pro-ga a]
429− =+ d=(~(get by q) b)
430− ?~ d 0
431− =+ e=(~(get by q) c)
432− ?~ e 0
433− =+ f=(~(get by p) (mod (add u.d u.e) ma))
434− (need f)
435− --
436−
437−XX document
438−
439−------------------------------------------------------------------------
docs/system/hoon/library/2ex.md−711

This diff is too big to show here.

docs/system/hoon/library/2ey.md−390

This diff is too big to show here.

docs/system/hoon/library/2ez.md−247

This diff is too big to show here.

docs/system/hoon/library/3ba.md−67

This diff is too big to show here.

docs/system/hoon/library/3bb.md−597

This diff is too big to show here.

docs/system/hoon/library/3bc.md−507

This diff is too big to show here.

docs/system/hoon/library/3bd.md+1−2918

This diff is too big to show here.

docs/system/hoon/library/3be.md−1316

This diff is too big to show here.

docs/system/hoon/library/3bf.md−392

This diff is too big to show here.

docs/system/hoon/library/3bg.md−1422

This diff is too big to show here.

docs/system/hoon/library/3bh.md−466

This diff is too big to show here.

docs/system/hoon/library/core/ab.mdnew file+1365

This diff is too big to show here.

docs/system/hoon/library/core/aesc.mdnew file+712

This diff is too big to show here.

docs/system/hoon/library/core/at.mdnew file+146

This diff is too big to show here.

docs/system/hoon/library/core/co.mdnew file+335

This diff is too big to show here.

docs/system/hoon/library/core/crua.mdnew file+598

This diff is too big to show here.

docs/system/hoon/library/core/epur.mdnew file+885

This diff is too big to show here.

docs/system/hoon/library/core/fe.mdnew file+416

This diff is too big to show here.

docs/system/hoon/library/core/fu.mdnew file+68

This diff is too big to show here.

docs/system/hoon/library/core/in.mdnew file+589

This diff is too big to show here.

docs/system/hoon/library/core/ja.mdnew file+229

This diff is too big to show here.

docs/system/hoon/library/core/jo.mdnew file+948

This diff is too big to show here.

docs/system/hoon/library/core/map.mdnew file+551

This diff is too big to show here.

docs/system/hoon/library/core/mu.mdnew file+124

This diff is too big to show here.

docs/system/hoon/library/core/ne.mdnew file+154

This diff is too big to show here.

docs/system/hoon/library/core/ob.mdnew file+255

This diff is too big to show here.

docs/system/hoon/library/core/og.mdnew file+55

This diff is too big to show here.

docs/system/hoon/library/core/po.mdnew file+200

This diff is too big to show here.

docs/system/hoon/library/core/poja.mdnew file+715

This diff is too big to show here.

docs/system/hoon/library/core/poxa.mdnew file+440

This diff is too big to show here.

docs/system/hoon/library/core/poxo.mdnew file+255

This diff is too big to show here.

docs/system/hoon/library/core/re.mdnew file+260

This diff is too big to show here.

docs/system/hoon/library/core/si.mdnew file+478

This diff is too big to show here.

docs/system/hoon/library/core/so.mdnew file+476

This diff is too big to show here.

docs/system/hoon/library/core/to.mdnew file+331

This diff is too big to show here.

docs/system/hoon/library/core/un.mdnew file+364

This diff is too big to show here.

docs/system/hoon/library/core/yo.mdnew file+256

This diff is too big to show here.

docs/system/hoon/library/core/yu.mdnew file+212

This diff is too big to show here.

docs/system/hoon/library/gate/ace.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/add.mdnew file+39

This diff is too big to show here.

docs/system/hoon/library/gate/alf.mdnew file+22

This diff is too big to show here.

docs/system/hoon/library/gate/aln.mdnew file+22

This diff is too big to show here.

docs/system/hoon/library/gate/alp.mdnew file+22

This diff is too big to show here.

docs/system/hoon/library/gate/aor.mdnew file+61

This diff is too big to show here.

docs/system/hoon/library/gate/bar.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/bas.mdnew file+28

This diff is too big to show here.

docs/system/hoon/library/gate/bass.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/bend.mdnew file+62

This diff is too big to show here.

docs/system/hoon/library/gate/bet.mdnew file+21

This diff is too big to show here.

docs/system/hoon/library/gate/bex.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/biff.mdnew file+36

This diff is too big to show here.

docs/system/hoon/library/gate/bin.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/bind.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/bond.mdnew file+39

This diff is too big to show here.

docs/system/hoon/library/gate/boss.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/both.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/buc.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/but.mdnew file+26

This diff is too big to show here.

docs/system/hoon/library/gate/cab.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/can.mdnew file+47

This diff is too big to show here.

docs/system/hoon/library/gate/cap.mdnew file+44

This diff is too big to show here.

docs/system/hoon/library/gate/cass.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/cat.mdnew file+52

This diff is too big to show here.

docs/system/hoon/library/gate/cen.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/cit.mdnew file+26

This diff is too big to show here.

docs/system/hoon/library/gate/clan.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/clap.mdnew file+44

This diff is too big to show here.

docs/system/hoon/library/gate/col.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/cold.mdnew file+42

This diff is too big to show here.

docs/system/hoon/library/gate/com.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/comp.mdnew file+48

This diff is too big to show here.

docs/system/hoon/library/gate/con.mdnew file+56

This diff is too big to show here.

docs/system/hoon/library/gate/cook.mdnew file+46

This diff is too big to show here.

docs/system/hoon/library/gate/cork.mdnew file+25

This diff is too big to show here.

docs/system/hoon/library/gate/corl.mdnew file+25

This diff is too big to show here.

docs/system/hoon/library/gate/crip.mdnew file+31

This diff is too big to show here.

docs/system/hoon/library/gate/cue.mdnew file+53

This diff is too big to show here.

docs/system/hoon/library/gate/curr.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/cury.mdnew file+34

This diff is too big to show here.

docs/system/hoon/library/gate/cuss.mdnew file+39

This diff is too big to show here.

docs/system/hoon/library/gate/cut.mdnew file+49

This diff is too big to show here.

docs/system/hoon/library/gate/dawn.mdnew file+39

This diff is too big to show here.

docs/system/hoon/library/gate/daws.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/deal.mdnew file+44

This diff is too big to show here.

docs/system/hoon/library/gate/dec.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/deft.mdnew file+48

This diff is too big to show here.

docs/system/hoon/library/gate/dem.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/dis.mdnew file+60

This diff is too big to show here.

docs/system/hoon/library/gate/dit.mdnew file+22

This diff is too big to show here.

docs/system/hoon/library/gate/div.mdnew file+43

This diff is too big to show here.

docs/system/hoon/library/gate/dog.mdnew file+21

This diff is too big to show here.

docs/system/hoon/library/gate/doh.mdnew file+25

This diff is too big to show here.

docs/system/hoon/library/gate/doq.mdnew file+28

This diff is too big to show here.

docs/system/hoon/library/gate/dor.mdnew file+52

This diff is too big to show here.

docs/system/hoon/library/gate/dot.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/drop.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/dun.mdnew file+20

This diff is too big to show here.

docs/system/hoon/library/gate/dust.mdnew file+42

This diff is too big to show here.

docs/system/hoon/library/gate/duz.mdnew file+21

This diff is too big to show here.

docs/system/hoon/library/gate/earl.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/earn.mdnew file+180

This diff is too big to show here.

docs/system/hoon/library/gate/easy.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/egcd.mdnew file+39

This diff is too big to show here.

docs/system/hoon/library/gate/end.mdnew file+50

This diff is too big to show here.

docs/system/hoon/library/gate/fail.mdnew file+31

This diff is too big to show here.

docs/system/hoon/library/gate/fain.mdnew file+56

This diff is too big to show here.

docs/system/hoon/library/gate/fall.mdnew file+34

This diff is too big to show here.

docs/system/hoon/library/gate/fas.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/feel.mdnew file+47

This diff is too big to show here.

docs/system/hoon/library/gate/fil.mdnew file+45

This diff is too big to show here.

docs/system/hoon/library/gate/file.mdnew file+44

This diff is too big to show here.

docs/system/hoon/library/gate/flop.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/fnv.mdnew file+33

This diff is too big to show here.

docs/system/hoon/library/gate/foal.mdnew file+43

This diff is too big to show here.

docs/system/hoon/library/gate/foo.shnew file+47

This diff is too big to show here.

docs/system/hoon/library/gate/fray.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/fuel.mdnew file+77

This diff is too big to show here.

docs/system/hoon/library/gate/full.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/funk.mdnew file+36

This diff is too big to show here.

docs/system/hoon/library/gate/furl.mdnew file+50

This diff is too big to show here.

docs/system/hoon/library/gate/gah.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/gal.mdnew file+26

This diff is too big to show here.

docs/system/hoon/library/gate/gap.mdnew file+12

This diff is too big to show here.

docs/system/hoon/library/gate/gaq.mdnew file+17

This diff is too big to show here.

docs/system/hoon/library/gate/gar.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/gaw.mdnew file+12

This diff is too big to show here.

docs/system/hoon/library/gate/gay.mdnew file+12

This diff is too big to show here.

docs/system/hoon/library/gate/glam.mdnew file+84

This diff is too big to show here.

docs/system/hoon/library/gate/glon.mdnew file+216

This diff is too big to show here.

docs/system/hoon/library/gate/glue.mdnew file+46

This diff is too big to show here.

docs/system/hoon/library/gate/gnom.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/gon.mdnew file+21

This diff is too big to show here.

docs/system/hoon/library/gate/gor.mdnew file+56

This diff is too big to show here.

docs/system/hoon/library/gate/gte.mdnew file+39

This diff is too big to show here.

docs/system/hoon/library/gate/gth.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/gul.mdnew file+20

This diff is too big to show here.

docs/system/hoon/library/gate/hard.mdnew file+29

This diff is too big to show here.

docs/system/hoon/library/gate/hax.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/hep.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/here.mdnew file+45

This diff is too big to show here.

docs/system/hoon/library/gate/hex.mdnew file+29

This diff is too big to show here.

docs/system/hoon/library/gate/hig.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/hit.mdnew file+27

This diff is too big to show here.

docs/system/hoon/library/gate/homo.mdnew file+41

This diff is too big to show here.

docs/system/hoon/library/gate/hor.mdnew file+49

This diff is too big to show here.

docs/system/hoon/library/gate/ifix.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/iny.mdnew file+58

This diff is too big to show here.

docs/system/hoon/library/gate/jam.mdnew file+58

This diff is too big to show here.

docs/system/hoon/library/gate/jape.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/jesc.mdnew file+41

This diff is too big to show here.

docs/system/hoon/library/gate/jest.mdnew file+48

This diff is too big to show here.

docs/system/hoon/library/gate/joba.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/jobe.mdnew file+34

This diff is too big to show here.

docs/system/hoon/library/gate/jone.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/just.mdnew file+48

This diff is too big to show here.

docs/system/hoon/library/gate/kel.mdnew file+26

This diff is too big to show here.

docs/system/hoon/library/gate/ker.mdnew file+26

This diff is too big to show here.

docs/system/hoon/library/gate/ket.mdnew file+23

This diff is too big to show here.

docs/system/hoon/library/gate/knee.mdnew file+54

This diff is too big to show here.

docs/system/hoon/library/gate/last.mdnew file+42

This diff is too big to show here.

docs/system/hoon/library/gate/lead.mdnew file+48

This diff is too big to show here.

docs/system/hoon/library/gate/lent.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/less.mdnew file+43

This diff is too big to show here.

docs/system/hoon/library/gate/levy.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/lien.mdnew file+26

This diff is too big to show here.

docs/system/hoon/library/gate/lift.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/limo.mdnew file+33

This diff is too big to show here.

docs/system/hoon/library/gate/low.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/lsh.mdnew file+45

This diff is too big to show here.

docs/system/hoon/library/gate/lte.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/lth.mdnew file+45

This diff is too big to show here.

docs/system/hoon/library/gate/lus.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/lust.mdnew file+46

This diff is too big to show here.

docs/system/hoon/library/gate/mack.mdnew file+45

This diff is too big to show here.

docs/system/hoon/library/gate/mang.mdnew file+55

This diff is too big to show here.

docs/system/hoon/library/gate/mas.mdnew file+48

This diff is too big to show here.

docs/system/hoon/library/gate/mask.mdnew file+46

This diff is too big to show here.

docs/system/hoon/library/gate/mat.mdnew file+54

This diff is too big to show here.

docs/system/hoon/library/gate/mate.mdnew file+49

This diff is too big to show here.

docs/system/hoon/library/gate/max.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/meat.mdnew file+48

This diff is too big to show here.

docs/system/hoon/library/gate/mes.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/mesc.mdnew file+42

This diff is too big to show here.

docs/system/hoon/library/gate/met.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/min.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/mink.mdnew file+122

This diff is too big to show here.

docs/system/hoon/library/gate/mix.mdnew file+52

This diff is too big to show here.

docs/system/hoon/library/gate/mo.mdnew file+34

This diff is too big to show here.

docs/system/hoon/library/gate/mock.mdnew file+50

This diff is too big to show here.

docs/system/hoon/library/gate/mod.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/mong.mdnew file+55

This diff is too big to show here.

docs/system/hoon/library/gate/mook.mdnew file+82

This diff is too big to show here.

docs/system/hoon/library/gate/moon.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/more.mdnew file+36

This diff is too big to show here.

docs/system/hoon/library/gate/most.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/mug.mdnew file+54

This diff is too big to show here.

docs/system/hoon/library/gate/mul.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/mule.mdnew file+52

This diff is too big to show here.

docs/system/hoon/library/gate/mum.mdnew file+69

This diff is too big to show here.

docs/system/hoon/library/gate/mung.mdnew file+55

This diff is too big to show here.

docs/system/hoon/library/gate/murn.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/mute.mdnew file+50

This diff is too big to show here.

docs/system/hoon/library/gate/need.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/next.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/nix.mdnew file+20

This diff is too big to show here.

docs/system/hoon/library/gate/not.mdnew file+44

This diff is too big to show here.

docs/system/hoon/library/gate/nud.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/pam.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/pat.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/peg.mdnew file+44

This diff is too big to show here.

docs/system/hoon/library/gate/pel.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/per.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/perk.mdnew file+49

This diff is too big to show here.

docs/system/hoon/library/gate/pfix.mdnew file+34

This diff is too big to show here.

docs/system/hoon/library/gate/plug.mdnew file+46

This diff is too big to show here.

docs/system/hoon/library/gate/plus.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/pojo.mdnew file+78

This diff is too big to show here.

docs/system/hoon/library/gate/pose.mdnew file+44

This diff is too big to show here.

docs/system/hoon/library/gate/prn.mdnew file+23

This diff is too big to show here.

docs/system/hoon/library/gate/qat.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/qit.mdnew file+36

This diff is too big to show here.

docs/system/hoon/library/gate/qu.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/qut.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/rap.mdnew file+41

This diff is too big to show here.

docs/system/hoon/library/gate/rash.mdnew file+41

This diff is too big to show here.

docs/system/hoon/library/gate/reap.mdnew file+36

This diff is too big to show here.

docs/system/hoon/library/gate/reel.mdnew file+43

This diff is too big to show here.

docs/system/hoon/library/gate/rep.mdnew file+49

This diff is too big to show here.

docs/system/hoon/library/gate/rip.mdnew file+49

This diff is too big to show here.

docs/system/hoon/library/gate/roll.mdnew file+43

This diff is too big to show here.

docs/system/hoon/library/gate/rsh.mdnew file+55

This diff is too big to show here.

docs/system/hoon/library/gate/rub.mdnew file+50

This diff is too big to show here.

docs/system/hoon/library/gate/runt.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/rush.mdnew file+39

This diff is too big to show here.

docs/system/hoon/library/gate/rust.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/sa.mdnew file+36

This diff is too big to show here.

docs/system/hoon/library/gate/sand.mdnew file+36

This diff is too big to show here.

docs/system/hoon/library/gate/sane.mdnew file+68

This diff is too big to show here.

docs/system/hoon/library/gate/saxo.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/scag.mdnew file+36

This diff is too big to show here.

docs/system/hoon/library/gate/scan.mdnew file+41

This diff is too big to show here.

docs/system/hoon/library/gate/scanf.mdnew file+83

This diff is too big to show here.

docs/system/hoon/library/gate/scot.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/scow.mdnew file+32

This diff is too big to show here.

docs/system/hoon/library/gate/sear.mdnew file+41

This diff is too big to show here.

docs/system/hoon/library/gate/sein.mdnew file+56

This diff is too big to show here.

docs/system/hoon/library/gate/sel.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/sem.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/ser.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/sfix.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/shad.mdnew file+7

This diff is too big to show here.

docs/system/hoon/library/gate/shaf.mdnew file+11

This diff is too big to show here.

docs/system/hoon/library/gate/shak.mdnew file+10

This diff is too big to show here.

docs/system/hoon/library/gate/shal.mdnew file+118

This diff is too big to show here.

docs/system/hoon/library/gate/sham.mdnew file+12

This diff is too big to show here.

docs/system/hoon/library/gate/shan.mdnew file+71

This diff is too big to show here.

docs/system/hoon/library/gate/shas.mdnew file+10

This diff is too big to show here.

docs/system/hoon/library/gate/shaw.mdnew file+8

This diff is too big to show here.

docs/system/hoon/library/gate/shax.mdnew file+92

This diff is too big to show here.

docs/system/hoon/library/gate/shaz.mdnew file+7

This diff is too big to show here.

docs/system/hoon/library/gate/shim.mdnew file+45

This diff is too big to show here.

docs/system/hoon/library/gate/show.mdnew file+103

This diff is too big to show here.

docs/system/hoon/library/gate/sifo.mdnew file+46

This diff is too big to show here.

docs/system/hoon/library/gate/sig.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/simu.mdnew file+44

This diff is too big to show here.

docs/system/hoon/library/gate/skid.mdnew file+36

This diff is too big to show here.

docs/system/hoon/library/gate/skim.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/skip.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/slag.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/slat.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/slav.mdnew file+43

This diff is too big to show here.

docs/system/hoon/library/gate/slaw.mdnew file+47

This diff is too big to show here.

docs/system/hoon/library/gate/slay.mdnew file+54

This diff is too big to show here.

docs/system/hoon/library/gate/slug.mdnew file+36

This diff is too big to show here.

docs/system/hoon/library/gate/smyt.mdnew file+43

This diff is too big to show here.

docs/system/hoon/library/gate/snag.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/soft.mdnew file+29

This diff is too big to show here.

docs/system/hoon/library/gate/some.mdnew file+32

This diff is too big to show here.

docs/system/hoon/library/gate/soq.mdnew file+25

This diff is too big to show here.

docs/system/hoon/library/gate/sort.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/soz.mdnew file+21

This diff is too big to show here.

docs/system/hoon/library/gate/spat.mdnew file+30

This diff is too big to show here.

docs/system/hoon/library/gate/spud.mdnew file+30

This diff is too big to show here.

docs/system/hoon/library/gate/stab.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/stag.mdnew file+43

This diff is too big to show here.

docs/system/hoon/library/gate/star.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/stet.mdnew file+50

This diff is too big to show here.

docs/system/hoon/library/gate/stew.mdnew file+54

This diff is too big to show here.

docs/system/hoon/library/gate/stir.mdnew file+47

This diff is too big to show here.

docs/system/hoon/library/gate/stud.mdnew file+58

This diff is too big to show here.

docs/system/hoon/library/gate/stun.mdnew file+50

This diff is too big to show here.

docs/system/hoon/library/gate/sub.mdnew file+43

This diff is too big to show here.

docs/system/hoon/library/gate/swag.mdnew file+33

This diff is too big to show here.

docs/system/hoon/library/gate/swp.mdnew file+40

This diff is too big to show here.

docs/system/hoon/library/gate/sym.mdnew file+26

This diff is too big to show here.

docs/system/hoon/library/gate/taco.mdnew file+27

This diff is too big to show here.

docs/system/hoon/library/gate/tact.mdnew file+34

This diff is too big to show here.

docs/system/hoon/library/gate/tame.mdnew file+54

This diff is too big to show here.

docs/system/hoon/library/gate/tar.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/tec.mdnew file+25

This diff is too big to show here.

docs/system/hoon/library/gate/teff.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/tell.mdnew file+39

This diff is too big to show here.

docs/system/hoon/library/gate/tis.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/tome.mdnew file+46

This diff is too big to show here.

docs/system/hoon/library/gate/tope.mdnew file+30

This diff is too big to show here.

docs/system/hoon/library/gate/trim.mdnew file+41

This diff is too big to show here.

docs/system/hoon/library/gate/trip.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/tuba.mdnew file+34

This diff is too big to show here.

docs/system/hoon/library/gate/tufa.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/tuft.mdnew file+59

This diff is too big to show here.

docs/system/hoon/library/gate/turf.mdnew file+54

This diff is too big to show here.

docs/system/hoon/library/gate/turn.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/txml.mdnew file+32

This diff is too big to show here.

docs/system/hoon/library/gate/unt.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/urld.mdnew file+48

This diff is too big to show here.

docs/system/hoon/library/gate/urle.mdnew file+51

This diff is too big to show here.

docs/system/hoon/library/gate/ven.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/vit.mdnew file+30

This diff is too big to show here.

docs/system/hoon/library/gate/vor.mdnew file+39

This diff is too big to show here.

docs/system/hoon/library/gate/vul.mdnew file+26

This diff is too big to show here.

docs/system/hoon/library/gate/wack.mdnew file+45

This diff is too big to show here.

docs/system/hoon/library/gate/weld.mdnew file+31

This diff is too big to show here.

docs/system/hoon/library/gate/welp.mdnew file+45

This diff is too big to show here.

docs/system/hoon/library/gate/wick.mdnew file+42

This diff is too big to show here.

docs/system/hoon/library/gate/woad.mdnew file+60

This diff is too big to show here.

docs/system/hoon/library/gate/wood.mdnew file+55

This diff is too big to show here.

docs/system/hoon/library/gate/wut.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/xeb.mdnew file+42

This diff is too big to show here.

docs/system/hoon/library/gate/yall.mdnew file+54

This diff is too big to show here.

docs/system/hoon/library/gate/yawn.mdnew file+60

This diff is too big to show here.

docs/system/hoon/library/gate/year.mdnew file+35

This diff is too big to show here.

docs/system/hoon/library/gate/yell.mdnew file+38

This diff is too big to show here.

docs/system/hoon/library/gate/yelp.mdnew file+37

This diff is too big to show here.

docs/system/hoon/library/gate/yore.mdnew file+36

This diff is too big to show here.

docs/system/hoon/library/gate/yule.mdnew file+55

This diff is too big to show here.

docs/system/hoon/library/gate/zap.mdnew file+24

This diff is too big to show here.

docs/system/hoon/library/gate/zing.mdnew file+37

This diff is too big to show here.