@@ -7,41 +7,40 @@ template = "doc.html"
9Parser modifier: LSB
9Parser modifier: LSB
10−ordered `++list` as atom of a `++base`.
10+ordered `list` as atom of a `base`.
12#### Accepts
12#### Accepts
14`wuc` is an atom.
14`wuc` is an atom.
16−`tyd` is a `++rule`.
16+`tyd` is a `rule`.
18#### Produces
18#### Produces
20−A `++rule`.
20+A `rule`.
22#### Source
22#### Source
26− |* {wuc/@ tyd/rule}
26+ |* [wuc=@ tyd=rule]
28− |= waq/(list @)
28+ |= waq=(list @)
31− =|({p/@ q/@} |.((add p (mul wuc q))))
31+ =|([p=@ q=@] |.((add p (mul wuc q))))
36#### Examples
35#### Examples
39− > (scan "123" (bass 10 (star dit)))
38+> (scan "123" (bass 10 (star dit)))
41− > (scan "123" (bass 8 (star dit)))
40+> (scan "123" (bass 8 (star dit)))
43− > `@ub`(scan "123" (bass 8 (star dit)))
42+> `@ub`(scan "123" (bass 8 (star dit)))
44− 0b101.0011
43+0b101.0011
@@ -50,43 +49,42 @@ A `++rule`.
51Parser modifier: LSB
50Parser modifier: LSB
53−Ordered `++list` as atom of a `++base`.
52+Ordered `list` as atom of a `base`.
55#### Accepts
54#### Accepts
57`wuc` is an atom.
56`wuc` is an atom.
59−`tyd` is a `++rule`.
58+`tyd` is a `rule`.
61#### Produces
60#### Produces
63−A `++rule`.
62+A `rule`.
65#### Source
64#### Source
69− |* {wuc/@ tyd/rule}
68+ |* [wuc=@ tyd=rule]
71− |= waq/(list @)
70+ |= waq=(list @)
74− =|({p/@ q/@} |.((add p (mul wuc q))))
73+ =|([p=@ q=@] |.((add p (mul wuc q))))
79#### Examples
77#### Examples
82− > (scan "123" (boss 10 (star dit)))
80+> (scan "123" (boss 10 (star dit)))
85− > `@t`(scan "bam" (boss 256 (star alp)))
83+> `@t`(scan "bam" (boss 256 (star alp)))
88− > `@ux`(scan "bam" (boss 256 (star alp)))
86+> `@ux`(scan "bam" (boss 256 (star alp)))
89− 0x6d.6162
87+0x6d.6162
@@ -95,41 +93,41 @@ A `++rule`.
96Replace with constant
94Replace with constant
98−Parser modifier. Accepts a `++rule` `sef` and produces a parser that
96+Parser modifier. Accepts a `rule` `sef` and produces a parser that produces a
99−produces a constant `cus`, assuming `sef` is successful.
97+constant `cus`, assuming `sef` is successful.
101#### Accepts
99#### Accepts
103`cus` is a constant noun.
101`cus` is a constant noun.
105−`sef` is a `++rule`.
103+`sef` is a `rule`.
107#### Produces
105#### Produces
109−An `++edge`.
107+An `edge`.
111#### Source
109#### Source
114− ++ cold :: replace w+ constant
112+++ cold
115− ~/ %cold
113+ ~/ %cold
116− |* {cus/* sef/rule}
114+ |* [cus=* sef=rule]
118− |= tub/nail
116+ |= tub=nail
119− =+ vex=(sef tub)
117+ =+ vex=(sef tub)
120− ?~ q.vex
118+ ?~ q.vex
122− [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]]
120+ [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]]
125#### Examples
123#### Examples
128− > ((cold %foo (just 'a')) [[1 1] "abc"])
126+> ((cold %foo (just 'a')) [[1 1] "abc"])
129− [p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]]
127+[p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]]
131− > ((cold %foo (just 'a')) [[1 1] "bc"])
129+> ((cold %foo (just 'a')) [[1 1] "bc"])
132− [p=[p=1 q=1] q=~]
130+[p=[p=1 q=1] q=~]
@@ -139,47 +137,46 @@ An `++edge`.
139Apply gate
137Apply gate
141Parser modifier. Produces a parser that takes a (successful) result of a
139Parser modifier. Produces a parser that takes a (successful) result of a
142−`++rule` `sef` and slams it through `poq`.
140+`rule` `sef` and slams it through `poq`.
144#### Accepts
142#### Accepts
146`poq` is a gate.
144`poq` is a gate.
148−`sef` is a `++rule`.
146+`sef` is a `rule`.
150#### Produces
148#### Produces
152−An `++rule`.
150+An `rule`.
154#### Source
152#### Source
157− ++ cook :: apply gate
155+++ cook
158− ~/ %cook
156+ ~/ %cook
159− |* {poq/gate sef/rule}
157+ |* [poq=gate sef=rule]
161− |= tub/nail
159+ |= tub=nail
162− =+ vex=(sef tub)
160+ =+ vex=(sef tub)
163− ?~ q.vex
161+ ?~ q.vex
165− [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]]
163+ [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]]
169#### Examples
166#### Examples
172− > ((cook ,@ud (just 'a')) [[1 1] "abc"])
169+> ((cook ,@ud (just 'a')) [[1 1] "abc"])
173− [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
170+[p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
175− > ((cook ,@tas (just 'a')) [[1 1] "abc"])
172+> ((cook ,@tas (just 'a')) [[1 1] "abc"])
176− [p=[p=1 q=2] q=[~ u=[p=%a q=[p=[p=1 q=2] q="bc"]]]]
173+[p=[p=1 q=2] q=[~ u=[p=%a q=[p=[p=1 q=2] q="bc"]]]]
178− > ((cook |=(a=@ +(a)) (just 'a')) [[1 1] "abc"])
175+> ((cook |=(a=@ +(a)) (just 'a')) [[1 1] "abc"])
179− [p=[p=1 q=2] q=[~ u=[p=98 q=[p=[p=1 q=2] q="bc"]]]]
176+[p=[p=1 q=2] q=[~ u=[p=98 q=[p=[p=1 q=2] q="bc"]]]]
181− > ((cook |=(a=@ `@t`+(a)) (just 'a')) [[1 1] "abc"])
178+> ((cook |=(a=@ `@t`+(a)) (just 'a')) [[1 1] "abc"])
182− [p=[p=1 q=2] q=[~ u=[p='b' q=[p=[p=1 q=2] q="bc"]]]]
179+[p=[p=1 q=2] q=[~ u=[p='b' q=[p=[p=1 q=2] q="bc"]]]]
@@ -197,32 +194,71 @@ without consuming any text.
198#### Produces
195#### Produces
200−A `++rule`.
197+A `rule`.
202#### Source
199#### Source
205− ++ easy :: always parse
202+++ easy
206− ~/ %easy
203+ ~/ %easy
207− |* huf=*
204+ |* huf=*
209− |= tub=nail
206+ |= tub=nail
210− ^- (like ,_huf)
207+ ^- (like _huf)
211− [p=p.tub q=[~ u=[p=huf q=tub]]]
208+ [p=p.tub q=[~ u=[p=huf q=tub]]]
215#### Examples
211#### Examples
218− > ((easy %foo) [[1 1] "abc"])
214+> ((easy %foo) [[1 1] "abc"])
219− [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]]
215+[p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]]
221− > ((easy %foo) [[1 1] "bc"])
217+> ((easy %foo) [[1 1] "bc"])
222− [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="bc"]]]]
218+[p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="bc"]]]]
224− > ((easy 'a') [[1 1] "bc"])
220+> ((easy 'a') [[1 1] "bc"])
225− [p=[p=1 q=1] q=[~ [p='a' q=[p=[p=1 q=1] q="bc"]]]]
221+[p=[p=1 q=1] q=[~ [p='a' q=[p=[p=1 q=1] q="bc"]]]]
230+If string `sic` is parsed: `%.y`. If string `non` is parsed: `%.n`. Otherwise, fail.
247+ ;~(pose (cold %& (jest sic)) (cold %| (jest non)))
253+> (rash 'foo' (fuss 'foo' 'bar'))
256+> (rash 'bar' (fuss 'foo' 'bar'))
259+> (rash 'baz' (fuss 'foo' 'bar'))
@@ -231,39 +267,38 @@ A `++rule`.
232Parse to end
268Parse to end
234−Parser modifier. Accepts a `++rule` `sef`, and produces a parser that succeeds only
270+Parser modifier. Accepts a `rule` `sef`, and produces a parser that succeeds
235−when the of `tub` is fully consumed using `sef`.
271+only when the `tape` of `tub` is fully consumed using `sef`.
237#### Accepts
273#### Accepts
239−`sef` is a `++rule`.
275+`sef` is a `rule`.
241#### Produces
277#### Produces
243−A `++rule`.
279+A `rule`.
245#### Source
281#### Source
248− ++ full :: parse to end
284+++ full
249− |* sef=_rule
285+ |* sef=rule
250− |= tub=nail
286+ |= tub=nail
251− =+ vex=(sef tub)
287+ =+ vex=(sef tub)
252− ?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~]))
288+ ?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~]))
256#### Examples
291#### Examples
259− > ((full (just 'a')) [[1 1] "ab"])
294+> ((full (just 'a')) [[1 1] "ab"])
260− [p=[p=1 q=2] q=~]
295+[p=[p=1 q=2] q=~]
262− > ((full (jest 'ab')) [[1 1] "ab"])
297+> ((full (jest 'ab')) [[1 1] "ab"])
263− [p=[p=1 q=3] q=[~ u=[p='ab' q=[p=[p=1 q=3] q=""]]]]
298+[p=[p=1 q=3] q=[~ u=[p='ab' q=[p=[p=1 q=3] q=""]]]]
265− > ((full ;~(plug (just 'a') (just 'b'))) [[1 1] "ab"])
300+> ((full ;~(plug (just 'a') (just 'b'))) [[1 1] "ab"])
266− [p=[p=1 q=3] q=[~ u=[p=[~~a ~~b] q=[p=[p=1 q=3] q=""]]]]
301+[p=[p=1 q=3] q=[~ u=[p=['a' 'b'] q=[p=[p=1 q=3] q=""]]]]
@@ -272,35 +307,35 @@ A `++rule`.
273Add to tape
308Add to tape
275−Parser modifier: prepend text to `++tape` before applying parser.
310+Parser modifier: prepend text to `tape` before applying parser.
277#### Accepts
312#### Accepts
279−`pre` is a `++tape`
314+`pre` is a `tape`
281−`sef` is a `++rule`
316+`sef` is a `rule`
283#### Produces
318#### Produces
285−A `++rule`.
320+A `rule`.
287#### Source
322#### Source
290− ++ funk :: add to tape first
325+++ funk
291− |* {pre/tape sef/rule}
326+ |* [pre=tape sef=rule]
292− |= tub/nail
327+ |= tub=nail
293− (sef p.tub (weld pre q.tub))
328+ (sef p.tub (weld pre q.tub))
296#### Examples
331#### Examples
299− > ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"])
334+> ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"])
300− [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]]
335+[p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]]
302− > ((funk "parse" (just 'a')) [[1 4] " me"])
337+> ((funk "parse" (just 'a')) [[1 4] " me"])
303− [p=[p=1 q=4] q=~]
338+[p=[p=1 q=4] q=~]
@@ -311,85 +346,139 @@ Place-based apply
312Parser modifier. Similar to `++cook` in that it produces a parser that takes a
347Parser modifier. Similar to `++cook` in that it produces a parser that takes a
313(successful) result of `sef` and slams it through `hez`. `hez` accepts a
348(successful) result of `sef` and slams it through `hez`. `hez` accepts a
314−`++pint` `a` and a noun `b`, which is what the parser parsed.
349+`pint` `a` and a noun `b`, which is what the parser parsed.
316#### Accepts
351#### Accepts
318`hez` is a gate.
353`hez` is a gate.
320−`sef` is a `++rule`
355+`sef` is a `rule`
322#### Produces
357#### Produces
324−A `++rule`.
359+A `rule`.
326#### Source
361#### Source
329− ++ here :: place-based apply
364+++ here
330− ~/ %here
365+ ~/ %here
331− |* {hez/_|=({a/pint b/*} [a b]) sef/rule}
366+ =+ [hez=|=([a=pint b=*] [a b]) sef=*rule]
333− |= tub/nail
370+ |= tub=nail
334− =+ vex=(sef tub)
371+ =+ vex=(sef tub)
335− ?~ q.vex
372+ ?~ q.vex
337− [p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]]
374+ [p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]]
341#### Examples
378#### Examples
344− > (scan "abc" (star alf))
381+> (scan "abc" (star alf))
384+> (scan "abc" (here |*(^ +<) (star alf)))
385+[[[p=1 q=1] p=1 q=4] "abc"]
387+> (scan "abc" (star (here |*(^ +<) alf)))
388+~[[[[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]]
395+Apply `rule` to indented block starting at current column number, omitting the
411+ =+ [har tap]=[p q]:+<
412+ =+ lev=(fil 3 (dec q.har) ' ')
413+ =+ eol=(just `@t`10)
414+ =+ =- roq=((star ;~(pose prn ;~(sfix eol (jest lev)) -)) har tap)
415+ ;~(simu ;~(plug eol eol) eol)
417+ =+ vex=(sef har(q 1) p.u.q.roq)
418+ =+ fur=p.vex(q (add (dec q.har) q.p.vex))
420+ =- vex(p fur, u.q -)
422+ &4.vex(q.p (add (dec q.har) q.p.&4.vex))
425+ ?. =(10 -.res) [-.res $(res +.res)]
426+ (welp [`@t`10 (trip lev)] $(res +.res))
347− > (scan "abc" (here |*(^ +<) (star alf)))
429+#### Examples
348− [[[p=1 q=1] p=1 q=4] "abc"]
350− > (scan "abc" (star (here |*(^ +<) alf)))
431+```
351− ~[[[[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]]
432+> `tape`(scan " foo\0a bar" ;~(pfix ace ace ace (inde (star ;~(pose prn (just '\0a'))))))
438+Note the amount of indentation whitespace to be stripped from the beginning of
439+each line is determined by the value of `q` (the column) in the `hair` when
440+`++inde` is first called. This means something like the `pfix` expression in the
441+example above is necessary to set the level of indentation. Additionally, the
442+`rule` given to `++inde` must consume the whole line including the line ending.
356## `++ifix`
446## `++ifix`
360−Parser modifier: surround with pair of `++rule`s, the output of which is
450+Parser modifier: surround with pair of `rule`s, the output of which is
361discarded.
451discarded.
363#### Accepts
453#### Accepts
365−`fel` is a pair of `++rule`s.
455+`fel` is a pair of `rule`s.
367−`hof` is a `++rule`.
457+`hof` is a `rule`.
369#### Produces
459#### Produces
371−A `++rule`.
461+A `rule`.
373#### Source
463#### Source
377− |* {fel/{rule rule} hof/rule}
467+ |* [fel=[rule rule] hof=rule]
379− ~! +<:-.fel
469+ ~! +<:-.fel
380− ~! +<:+.fel
470+ ~! +<:+.fel
381− ;~(pfix -.fel ;~(sfix hof +.fel))
471+ ;~(pfix -.fel ;~(sfix hof +.fel))
385#### Examples
474#### Examples
388− > (scan "-40-" (ifix [hep hep] dem))
477+> (scan "-40-" (ifix [hep hep] dem))
391− > (scan "4my4" (ifix [dit dit] (star alf)))
480+> (scan "4my4" (ifix [dit dit] (star alf)))
@@ -406,43 +495,42 @@ Match and consume a cord.
407#### Produces
496#### Produces
409−An `++edge`.
498+A `rule`.
411#### Source
500#### Source
414− ++ jest :: match a cord
503+++ jest
415− |= daf/@t
504+ |= daf=@t
416− |= tub/nail
505+ |= tub=nail
417− =+ fad=daf
506+ =+ fad=daf
418− |- ^- (like @t)
507+ |- ^- (like @t)
419− ?: =(`@`0 daf)
508+ ?: =(`@`0 daf)
420− [p=p.tub q=[~ u=[p=fad q=tub]]]
509+ [p=p.tub q=[~ u=[p=fad q=tub]]]
421− ?: |(?=($~ q.tub) !=((end 3 1 daf) i.q.tub))
510+ ?: |(?=(~ q.tub) !=((end 3 daf) i.q.tub))
422− (fail tub)
511+ (fail tub)
423− $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 1 daf))
512+ $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 daf))
427#### Examples
515#### Examples
430− > ((jest 'abc') [[1 1] "abc"])
518+> ((jest 'abc') [[1 1] "abc"])
431− [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]]
519+[p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]]
433− > (scan "abc" (jest 'abc'))
521+> (scan "abc" (jest 'abc'))
436− > (scan "abc" (jest 'acb'))
524+> (scan "abc" (jest 'acb'))
438− ! 'syntax-error'
526+! 'syntax-error'
441− > ((jest 'john doe') [[1 1] "john smith"])
529+> ((jest 'john doe') [[1 1] "john smith"])
442− [p=[p=1 q=6] q=~]
530+[p=[p=1 q=6] q=~]
444− > ((jest 'john doe') [[1 1] "john doe"])
532+> ((jest 'john doe') [[1 1] "john doe"])
445− [p=[p=1 q=9] q=[~ [p='john doe' q=[p=[p=1 q=9] q=""]]]]
533+[p=[p=1 q=9] q=[~ [p='john doe' q=[p=[p=1 q=9] q=""]]]]
@@ -455,45 +543,44 @@ Match and consume a single character.
456#### Accepts
544#### Accepts
458−`daf` is a `++char`
546+`daf` is a `char`
460#### Produces
548#### Produces
462−A `++rule`.
550+A `rule`.
464#### Source
552#### Source
467− ++ just :: XX redundant, jest
555+++ just
468− ~/ %just :: match a char
556+ ~/ %just
469− |= daf/char
557+ |= daf=char
471− |= tub/nail
559+ |= tub=nail
472− ^- (like char)
560+ ^- (like char)
473− ?~ q.tub
561+ ?~ q.tub
474− (fail tub)
562+ (fail tub)
475− ?. =(daf i.q.tub)
563+ ?. =(daf i.q.tub)
476− (fail tub)
564+ (fail tub)
477− (next tub)
565+ (next tub)
481#### Examples
568#### Examples
484− > ((just 'a') [[1 1] "abc"])
571+> ((just 'a') [[1 1] "abc"])
485− [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
572+[p=[p=1 q=2] q=[~ [p='a' q=[p=[p=1 q=2] q="bc"]]]]
487− > (scan "abc" (just 'a'))
574+> (scan "abc" (just 'a'))
489− ! 'syntax-error'
576+! 'syntax-error'
492− > (scan "a" (just 'a'))
579+> (scan "a" (just 'a'))
495− > (scan "%" (just '%'))
582+> (scan "%" (just '%'))
@@ -509,47 +596,49 @@ compiled.
510`gar` is a noun.
597`gar` is a noun.
512−`sef` is a gate that accepts a `++rule`
599+`sef` is a gate that accepts a `rule`
514#### Produces
601#### Produces
516−A `++rule`.
603+A `rule`.
518#### Source
605#### Source
521− ++ knee :: callbacks
608+++ knee
522− |* {gar/* sef/_|.(*rule)}
609+ =| [gar=* sef=_|.(*rule)]
523− |= tub/nail
611+ |= tub=nail
524− ^- (like _gar)
612+ ^- (like _gar)
525− ((sef) tub)
613+ ((sef) tub)
529#### Examples
617#### Examples
532− > |-(;~(plug prn ;~(pose $ (easy ~))))
620+> |-(;~(plug prn ;~(pose $ (easy ~))))
533− ! rest-loop
621+! rest-loop
536− > |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~))))
624+> |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~))))
538− [ c=c=tub=[p=[p=@ud q=@ud] q=""]
626+ [ c=c=tub=[p=[p=@ud q=@ud] q=""]
541− [ c=tub=[p=[p=@ud q=@ud] q=""]
629+ [ c=tub=[p=[p=@ud q=@ud] q=""]
542− b=<1.tnv [tub=[p=[p=@ud q=@ud] q=""] <1.ktu [daf=@tD <414.fvk 101.jzo 1.ypj %164>]>]>
630+ b=<1.tnv [tub=[p=[p=@ud q=@ud] q=""] <1.ktu [daf=@tD <414.fvk 101.jzo 1.ypj %164>]>]>
543− a=<1.fvg [tub=[p=[p=@ud q=@ud] q=""] <1.khu [[les=@ mos=@] <414.fvk 101.jzo 1.ypj %164>]>]>
631+ a=<1.fvg [tub=[p=[p=@ud q=@ud] q=""] <1.khu [[les=@ mos=@] <414.fvk 101.jzo 1.ypj %164>]>]>
544− v=<414.fvk 101.jzo 1.ypj %164>
632+ v=<414.fvk 101.jzo 1.ypj %164>
548− ... 450 lines omitted ...
636+ ... 450 lines omitted ...
551− > (scan "abcd" |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~)))))
640+> (scan "abcd" |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~)))))
552− [~~a "bcd"]
641+['a' "bcd"]
@@ -558,48 +647,46 @@ A `++rule`.
559Match char
648Match char
561−Parser generator. Matches the next character if it is in a list of
650+Parser generator. Matches the next character if it is in a list of characters.
564#### Accepts
652#### Accepts
566−`bud` is a list of `++char`
654+`bud` is a list of `char`
568#### Produces
656#### Produces
570−A `++rule`.
658+A `rule`.
572#### Source
660#### Source
575− ++ mask :: match char in set
663+++ mask
576− ~/ %mask
664+ ~/ %mask
577− |= bud/(list char)
665+ |= bud=(list char)
579− |= tub/nail
667+ |= tub=nail
580− ^- (like char)
668+ ^- (like char)
581− ?~ q.tub
669+ ?~ q.tub
582− (fail tub)
670+ (fail tub)
583− ?. (lien bud |=(a/char =(i.q.tub a)))
671+ ?. (lien bud |=(a=char =(i.q.tub a)))
584− (fail tub)
672+ (fail tub)
585− (next tub)
673+ (next tub)
589#### Examples
676#### Examples
592− > (scan "a" (mask "cba"))
679+> (scan "a" (mask "cba"))
595− > ((mask "abc") [[1 1] "abc"])
682+> ((mask "abc") [[1 1] "abc"])
596− [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
683+[p=[p=1 q=2] q=[~ [p='a' q=[p=[p=1 q=2] q="bc"]]]]
598− > ((mask "abc") [[1 1] "bbc"])
685+> ((mask "abc") [[1 1] "bbc"])
599− [p=[p=1 q=2] q=[~ [p=~~b q=[p=[p=1 q=2] q="bc"]]]]
686+[p=[p=1 q=2] q=[~ [p='b' q=[p=[p=1 q=2] q="bc"]]]]
601− > ((mask "abc") [[1 1] "dbc"])
688+> ((mask "abc") [[1 1] "dbc"])
602− [p=[p=1 q=1] q=~]
689+[p=[p=1 q=1] q=~]
@@ -608,38 +695,37 @@ A `++rule`.
609Parse list with delimiter
696Parse list with delimiter
611−Parser modifier: Parse a list of matches using a delimiter `++rule`.
698+Parser modifier: Parse a list of matches using a delimiter `rule`.
613#### Accepts
700#### Accepts
615−`bus` is a `++rule`.
702+`bus` is a `rule`.
617−`fel` is a `++rule`.
704+`fel` is a `rule`.
619#### Produces
706#### Produces
621−A `++rule`.
708+A `rule`.
623#### Source
710#### Source
627− |* {bus/rule fel/rule}
714+ |* [bus=rule fel=rule]
628− ;~(pose (most bus fel) (easy ~))
715+ ;~(pose (most bus fel) (easy ~))
632#### Examples
718#### Examples
635− > (scan "" (more ace dem))
721+> (scan "" (more ace dem))
638− > (scan "40 20" (more ace dem))
724+> (scan "40 20" (more ace dem))
639− [q=40 ~[q=20]]
725+[40 [i=20 t=~]]
641− > (scan "40 20 60 1 5" (more ace dem))
727+> (scan "40 20 60 1 5" (more ace dem))
642− [q=40 ~[q=20 q=60 q=1 q=5]]
728+[40 [i=20 t=~[60 1 5]]]
@@ -648,39 +734,38 @@ A `++rule`.
649Parse list of at least one match
735Parse list of at least one match
651−Parser modifier: parse a `++list` of at least one match using a delimiter `++rule`.
737+Parser modifier: parse a `list` of at least one match using a delimiter `rule`.
653#### Accepts
739#### Accepts
655−`bus` is a `++rule`.
741+`bus` is a `rule`.
657−`fel` is a `++rule`.
743+`fel` is a `rule`.
659#### Produces
745#### Produces
661−A `++rule`.
747+A `rule`.
663#### Source
749#### Source
667− |* {bus/rule fel/rule}
753+ |* [bus=rule fel=rule]
668− ;~(plug fel (star ;~(pfix bus fel)))
754+ ;~(plug fel (star ;~(pfix bus fel)))
672#### Examples
757#### Examples
675− > (scan "40 20" (most ace dem))
760+> (scan "40 20" (most ace dem))
676− [q=40 ~[q=20]]
761+[40 [i=20 t=~]]
678− > (scan "40 20 60 1 5" (most ace dem))
763+> (scan "40 20 60 1 5" (most ace dem))
679− [q=40 ~[q=20 q=60 q=1 q=5]]
764+[40 [i=20 t=~[60 1 5]]]
681− > (scan "" (most ace dem))
766+> (scan "" (most ace dem))
@@ -693,33 +778,76 @@ Consume any character, producing it as a result.
694#### Accepts
779#### Accepts
696−`tub` is a `++nail`
781+`tub` is a `nail`
698#### Produces
783#### Produces
700−An `++edge`.
785+An `edge`.
702#### Source
787#### Source
705− ++ next :: consume a char
790+++ next
706− |= tub/nail
791+ |= tub=nail
707− ^- (like char)
792+ ^- (like char)
708− ?~ q.tub
793+ ?~ q.tub
709− (fail tub)
794+ (fail tub)
710− =+ zac=(lust i.q.tub p.tub)
795+ =+ zac=(lust i.q.tub p.tub)
711− [zac [~ i.q.tub [zac t.q.tub]]]
796+ [zac [~ i.q.tub [zac t.q.tub]]]
715#### Examples
799#### Examples
718− > (next [[1 1] "ebc"])
802+> (next [[1 1] "ebc"])
719− [p=[p=1 q=2] q=[~ [p=~~e q=[p=[p=1 q=2] q="bc"]]]]
803+[p=[p=1 q=2] q=[~ [p='e' q=[p=[p=1 q=2] q="bc"]]]]
721− > (next [[1 1] "john jumps jones"])
805+> (next [[1 1] "john jumps jones"])
722− [p=[p=1 q=2] q=[~ [p=~~j q=[p=[p=1 q=2] q="ohn jumps jones"]]]]
806+[p=[p=1 q=2] q=[~ [p='j' q=[p=[p=1 q=2] q="ohn jumps jones"]]]]
815+Given `a`, a list of `@tas`, match any one in the list and produce it. Note the
816+list should not be a `list` type, but just a null-terminated cell like `~[%foo %bar %baz]`. The type produced will be a union of the items in the given list,
817+so you can use a `?-` expression on the output.
821+`a` is a `(pole @tas)`.
834+ (cold -.a (jest -.a))
842+> (scan "foo" (perk ~[%foo %bar]))
845+> (scan "bar" (perk ~[%foo %bar]))
848+> (scan "baz" (perk ~[%foo %bar]))
@@ -728,79 +856,112 @@ An `++edge`.
729List of at least one match.
857List of at least one match.
731−Parser modifier: parse `++list` of at least one match.
859+Parser modifier: parse `list` of at least one match.
733#### Accepts
861#### Accepts
735−`fel` is a `++rule`.
863+`fel` is a `rule`.
737#### Produces
865#### Produces
739−A `++rule`.
867+A `rule`.
741#### Source
869#### Source
744− ++ plus |*(fel/rule ;~(plug fel (star fel)))
872+++ plus |*(fel=rule ;~(plug fel (star fel))) ::
747#### Examples
875#### Examples
750− > (scan ">>>>" (cook lent (plus gar)))
878+> (scan ">>>>" (cook lent (plus gar)))
753− > (scan "- - " (plus ;~(pose ace hep)))
881+> (scan "- - " (plus ;~(pose ace hep)))
754− [~~- " - "]
882+['-' [i=' ' t=~[' ' '-' ' ']]]
756− > `tape`(scan "- - " (plus ;~(pose ace hep)))
884+> `tape`(scan "- - " (plus ;~(pose ace hep)))
759− > `(pole ,@t)`(scan "- - " (plus ;~(pose ace hep)))
887+> `(pole ,@t)`(scan "- - " (plus ;~(pose ace hep)))
760− ['-' [' ' [' ' ['-' [' ' ~]]]]]
888+['-' [' ' [' ' ['-' [' ' ~]]]]]
897+Either successfully apply `rule` `a` and produce a `unit` of the result, or produce `~`.
910+++ punt |*([a=rule] ;~(pose (stag ~ a) (easy ~)))
916+> ((punt (jest 'foo')) 1^1 "foo")
917+[p=[p=1 q=4] q=[~ u=[p=[~ 'foo'] q=[p=[p=1 q=4] q=~]]]]
919+> ((punt (jest 'foo')) 1^1 "bar")
920+[p=[p=1 q=1] q=[~ [p=~ q=[p=[p=1 q=1] q="bar"]]]]
765## `++sear`
925## `++sear`
767−Conditional `++cook`
927+Conditional `cook`
769−Conditional `++cook`. Slams the result through a gate that produces
929+Conditional `cook`. Slams the result through a gate that produces
770a unit; if that unit is empty, fail.
930a unit; if that unit is empty, fail.
772#### Accepts
932#### Accepts
774−`tub` is a `++nail`.
934+`pyq` is a gate that produces a `unit`.
776#### Produces
938#### Produces
778−A `++rule`.
940+A `rule`.
780#### Source
942#### Source
783− ++ sear :: conditional cook
945+++ sear
784− |* {pyq/$-(* (unit)) sef/rule}
946+ |* [pyq=$-(* (unit)) sef=rule]
785− |= tub/nail
947+ |= tub=nail
786− =+ vex=(sef tub)
948+ =+ vex=(sef tub)
787− ?~ q.vex
949+ ?~ q.vex
789− =+ gey=(pyq p.u.q.vex)
951+ =+ gey=(pyq p.u.q.vex)
791− [p=p.vex q=~]
953+ [p=p.vex q=~]
792− [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]]
954+ [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]]
796#### Examples
957#### Examples
799− > ((sear |=(a/* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"])
960+> ((sear |=(a=* ?@(a (some a) ~)) (just 'a')) [[1 1] "abc"])
800− [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
961+[p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
802− > ((sear |=(* ~) (just 'a')) [[1 1] "abc"])
963+> ((sear |=(* ~) (just 'a')) [[1 1] "abc"])
803− [p=[p=1 q=2] q=~]
964+[p=[p=1 q=2] q=~]
@@ -809,7 +970,7 @@ A `++rule`.
810Char in range
971Char in range
812−Match characters (`++char`) within a range.
973+Match characters (`char`) within a range.
814#### Accepts
975#### Accepts
@@ -819,75 +980,73 @@ Match characters (`++char`) within a range.
820#### Produces
981#### Produces
822−A `++rule`.
983+A `rule`.
824#### Source
985#### Source
827− ++ shim :: match char in range
988+++ shim
828− ~/ %shim
989+ ~/ %shim
829− |= {les/@ mos/@}
990+ |= [les=@ mos=@]
831− |= tub/nail
992+ |= tub=nail
832− ^- (like char)
993+ ^- (like char)
833− ?~ q.tub
994+ ?~ q.tub
834− (fail tub)
995+ (fail tub)
835− ?. ?&((gte i.q.tub les) (lte i.q.tub mos))
996+ ?. ?&((gte i.q.tub les) (lte i.q.tub mos))
836− (fail tub)
997+ (fail tub)
837− (next tub)
998+ (next tub)
841#### Examples
1001#### Examples
844− > ((shim 'a' 'z') [[1 1] "abc"])
1004+> `tape`(rash 'abc' (plus (shim 'a' 'z')))
845− [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
1005+"abc"
847− > ((shim 'a' 'Z') [[1 1] "abc"])
1007+> `tape`(rash 'ABC' (plus (shim 'a' 'z')))
848− [p=[p=1 q=1] q=~]
1008+{1 1}
850− > ((shim 'a' 'Z') [[1 1] "Abc"])
851− [p=[p=1 q=2] q=[~ [p=~~~41. q=[p=[p=1 q=2] q="bc"]]]]
856−## `++slug` {#slug}
1014+## `++slug`
858Use gate to parse delimited list
1016Use gate to parse delimited list
860−Parser modifier: By composing with a gate, parse a delimited `++list` of
1018+Parser modifier: By composing with a gate, parse a delimited `list` of
863#### Accepts
1021#### Accepts
1023+`raq` is a binary gate.
865−`bus` is a `++rule`.
1025+`bus` is a `rule`.
867−`fel` is a `++rule`.
1027+`fel` is a `rule`.
869#### Produces
1029#### Produces
871−A `++rule`.
1031+A `rule`.
873#### Source
1033#### Source
877− |* raq/_|*({a/* b/*} [a b])
1037+ |* raq=_=>(~ |*([a=* b=*] [a b]))
878− |* {bus/rule fel/rule}
1038+ |* [bus=rule fel=rule]
879− ;~((comp raq) fel (stir +<+.raq raq ;~(pfix bus fel)))
1039+ ;~((comp raq) fel (stir +<+.raq raq ;~(pfix bus fel)))
883#### Examples
1042#### Examples
886− > (scan "20+5+110" ((slug add) lus dem))
1045+> (scan "20+5+110" ((slug add) lus dem))
889− > `@t`(scan "a b c" ((slug |=(a/[@ @t] (cat 3 a))) ace alp))
1048+> `@t`(scan "a b c" ((slug |=(a=[@t @t] (cat 3 a))) ace alp))
@@ -896,7 +1055,7 @@ A `++rule`.
897Add label
1056Add label
899−Add a label to an edge parsed by a rule.
1058+Add a label to an `edge` parsed by a `rule`.
901#### Accepts
1060#### Accepts
@@ -906,34 +1065,27 @@ Add a label to an edge parsed by a rule.
907#### Produces
1066#### Produces
909−A `++rule`.
1068+A `rule`.
911#### Source
1070#### Source
914− ++ stag :: add a label
1073+++ stag
915− ~/ %stag
1074+ ~/ %stag
916− |* {gob/* sef/rule}
1075+ |* [gob=* sef=rule]
917− ~/ %fun
1076+ ~/ %fun
918− |= tub/nail
1077+ |= tub=nail
919− =+ vex=(sef tub)
1078+ =+ vex=(sef tub)
920− ?~ q.vex
1079+ ?~ q.vex
922− [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]]
1081+ [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]]
926#### Examples
1084#### Examples
929− > ((stag %foo (just 'a')) [[1 1] "abc"])
1087+> (rash 'abc' (stag %foo (jest 'abc')))
930− [p=[p=1 q=2] q=[~ u=[p=[%foo ~~a] q=[p=[p=1 q=2] q="bc"]]]]
1088+[%foo 'abc']
932− > ((stag "xyz" (jest 'abc')) [[1 1] "abc"])
933− [p=[p=1 q=4] q=[~ u=[p=["xyz" 'abc'] q=[p=[p=1 q=4] q=""]]]]
935− > ((stag 10.000 (shim 0 100)) [[1 1] "abc"])
936− [p=[p=1 q=2] q=[~ u=[p=[10.000 ~~a] q=[p=[p=1 q=2] q="bc"]]]]
@@ -942,41 +1094,45 @@ A `++rule`.
943List of matches
1095List of matches
945−Parser modifier: parse `++list` of matches.
1097+Parser modifier: parse `list` of matches.
947#### Accepts
1099#### Accepts
949−`fel` is a `++rule`.
1101+`fel` is a `rule`.
951#### Produces
1103#### Produces
954− ++ star :: 0 or more times
1110+++ star
955− |* fel/rule
1111+ |* fel=rule
956− (stir `(list _(wonk *fel))`~ |*({a/* b/*} [a b]) fel)
1112+ (stir `(list _(wonk *fel))`~ |*([a=* b=*] [a b]) fel)
959#### Examples
1115#### Examples
962− > (scan "aaaaa" (just 'a'))
1118+> (scan "aaaaa" (just 'a'))
964− ! 'syntax-error'
1120+! 'syntax-error'
967− > (scan "aaaaa" (star (just 'a')))
1123+> (scan "aaaaa" (star (just 'a')))
970− > (scan "abcdef" (star (just 'a')))
1126+> (scan "abcdef" (star (just 'a')))
972− ! 'syntax-error'
1128+! 'syntax-error'
975− > (scan "abcabc" (star (jest 'abc')))
1131+> (scan "abcabc" (star (jest 'abc')))
976− <|abc abc|>
1132+<|abc abc|>
978− > (scan "john smith" (star (shim 0 200)))
1134+> (scan "john smith" (star (shim 0 200)))
979− "john smith"
1135+"john smith"
@@ -985,7 +1141,8 @@ Parser modifier: parse `++list` of matches.
986Add faces
1142Add faces
988−Add faces `[p q]` to range-parser pairs in a list.
1144+Add faces `[p q]` to range-parser pairs in a list. Typically used in combination
1145+with [`++stew`](#stew).
990#### Accepts
1147#### Accepts
@@ -993,97 +1150,114 @@ Add faces `[p q]` to range-parser pairs in a list.
994#### Produces
1151#### Produces
1153+A `(list [p=?(@ [@ @]) q=rule])`.
996#### Source
1155#### Source
1000− |* leh/(list {?(@ {@ @}) rule})
1159+ |* leh=(list [?(@ [@ @]) rule])
1004− [i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)]
1163+ [i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)]
1008#### Examples
1166#### Examples
1011− > (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)]
1169+> =rule %- stew
1012− [[1 10] (cold %foo (just 'a'))]~]))
1170+ %- stet
1014− [p=5 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
1172+ :~
1015− [p=1 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
1173+ [['a' 'z'] (cook |=(a=@ (sub a 32)) alp)]
1016− [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
1174+ [['A' 'Z'] (cook |=(a=@ (add a 32)) alp)]
1017− [p=[1 10] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
1175+ ==
1019− > [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~]
1177+> `tape`(rash 'fooBARbaz' (star rule))
1020− [ [[1 1] <1.tnv [tub=[p=[p=@ud q=@ud] q=""] <1.ktu [daf=@tD <414.fvk 101.jzo 1.ypj %164>]>]>]
1178+"FOObarBAZ"
1021− [[2 1] <1.fvg [tub=[p=[p=@ud q=@ud] q=""] <1.khu [[les=@ mos=@] <414.fvk 101.jzo 1.ypj %164>]>]>]
1024− > (stet (limo [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~]))
1026− [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
1027− [p=[2 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
1033## `++stew`
1183## `++stew`
1035−Switch by first
1185+Switch by first char
1187+Parser generator. From an associative `list` of characters or character
1188+ranges to `rule`s, construct a `map`, and parse `tape`s only
1189+with `rule`s associated with a range that the `tape`'s first character falls in.
1193+`leh` is a `(list [p=?(@ [@ @]) q=rule])`, where `p` is a `char` or `char` range.
1038− ++ stew :: switch by first char
1202+++ stew :: switch by first char
1039− ~/ %stew
1203+ ~/ %stew
1040− |* leh/(list {p/?(@ {@ @}) q/rule}) :: char+range keys
1204+ |* leh=(list [p=?(@ [@ @]) q=rule]) :: char+range keys
1041− =+ ^= wor :: range complete lth
1205+ =+ ^= wor :: range complete lth
1042− |= {ort/?(@ {@ @}) wan/?(@ {@ @})}
1206+ |= [ort=?(@ [@ @]) wan=?(@ [@ @])]
1044− ?@(wan (lth ort wan) (lth ort -.wan))
1208+ ?@(wan (lth ort wan) (lth ort -.wan))
1045− ?@(wan (lth +.ort wan) (lth +.ort -.wan))
1209+ ?@(wan (lth +.ort wan) (lth +.ort -.wan))
1046− =+ ^= hel :: build parser map
1210+ =+ ^= hel :: build parser map
1047− =+ hel=`(tree _?>(?=(^ leh) i.leh))`~
1211+ =+ hel=`(tree _?>(?=(^ leh) i.leh))`~
1048− |- ^+ hel
1212+ |- ^+ hel
1051− =+ yal=$(leh t.leh)
1215+ =+ yal=$(leh t.leh)
1052− |- ^+ hel
1216+ |- ^+ hel
1054− [i.leh ~ ~]
1218+ [i.leh ~ ~]
1055− ?: (wor p.i.leh p.n.yal)
1219+ ?: (wor p.i.leh p.n.yal)
1056− =+ nuc=$(yal l.yal)
1220+ =+ nuc=$(yal l.yal)
1057− ?> ?=(^ nuc)
1221+ ?> ?=(^ nuc)
1058− ?: (vor p.n.yal p.n.nuc)
1222+ ?: (mor p.n.yal p.n.nuc)
1059− [n.yal nuc r.yal]
1223+ [n.yal nuc r.yal]
1060− [n.nuc l.nuc [n.yal r.nuc r.yal]]
1224+ [n.nuc l.nuc [n.yal r.nuc r.yal]]
1061− =+ nuc=$(yal r.yal)
1225+ =+ nuc=$(yal r.yal)
1062− ?> ?=(^ nuc)
1226+ ?> ?=(^ nuc)
1063− ?: (vor p.n.yal p.n.nuc)
1227+ ?: (mor p.n.yal p.n.nuc)
1064− [n.yal l.yal nuc]
1228+ [n.yal l.yal nuc]
1065− [n.nuc [n.yal l.yal l.nuc] r.nuc]
1229+ [n.nuc [n.yal l.yal l.nuc] r.nuc]
1066− ~% %fun ..^$ ~
1230+ ~% %fun ..^$ ~
1067− |= tub/nail
1231+ |= tub=nail
1068− ?~ q.tub
1232+ ?~ q.tub
1069− (fail tub)
1233+ (fail tub)
1072− (fail tub)
1236+ (fail tub)
1073− ?: ?@ p.n.hel
1237+ ?: ?@ p.n.hel
1074− =(p.n.hel i.q.tub)
1238+ =(p.n.hel i.q.tub)
1075− ?&((gte i.q.tub -.p.n.hel) (lte i.q.tub +.p.n.hel))
1239+ ?&((gte i.q.tub -.p.n.hel) (lte i.q.tub +.p.n.hel))
1076− :: (q.n.hel [(lust i.q.tub p.tub) t.q.tub])
1240+ :: (q.n.hel [(lust i.q.tub p.tub) t.q.tub])
1077− (q.n.hel tub)
1241+ (q.n.hel tub)
1078− ?: (wor i.q.tub p.n.hel)
1242+ ?: (wor i.q.tub p.n.hel)
1079− $(hel l.hel)
1243+ $(hel l.hel)
1080− $(hel r.hel)
1244+ $(hel r.hel)
1084−Parser generator. From an associative `++list` of characters or character
1247+#### Examples
1085−ranges to `++rule`s, construct a `++map`, and parse `++tape`s only
1248+
1086−with `++rules` associated with a range that the `++tape`'s first character falls in.
1249+```
1254+ [['a' 'z'] (cook |=(a=@ (sub a 32)) alp)]
1255+ [['A' 'Z'] (cook |=(a=@ (add a 32)) alp)]
1258+> `tape`(rash 'fooBARbaz' (star rule))
@@ -1091,7 +1265,7 @@ with `++rules` associated with a range that the `++tape`'s first character falls
1092Parse repeatedly
1266Parse repeatedly
1094−Parse with `++rule` as many times as possible, and fold over results with a
1268+Parse with `rule` as many times as possible, and fold over results with a
1095binary gate.
1269binary gate.
1097#### Accepts
1271#### Accepts
@@ -1100,37 +1274,51 @@ binary gate.
1101`raq` is a gate that takes two nouns and produces a cell.
1275`raq` is a gate that takes two nouns and produces a cell.
1103−`fel` is a rule.
1277+`fel` is a `rule`.
1105#### Produces
1279#### Produces
1107−A rule.
1281+A `rule`.
1109#### Source
1283#### Source
1112− ++ stir
1286+++ stir
1113− ~/ %stir
1287+ ~/ %stir
1114− |* {rud/* raq/_=>(~ |*({a/* b/*} [a b])) fel/rule}
1288+ |* [rud=* raq=_=>(~ |*([a=* b=*] [a b])) fel=rule]
1115− ~/ %fun
1289+ ~/ %fun
1116− |= tub/nail
1290+ |= tub=nail
1117− ^- (like _rud)
1291+ ^- (like _rud)
1293+ :: lef: successful interim parse results (per .fel)
1294+ :: wag: initial accumulator (.rud in .tub at farthest success)
1297+ =| lef=(list _(fel tub))
1298+ |- ^- [_lef (pair hair [~ u=(pair _rud nail)])]
1118− =+ vex=(fel tub)
1299+ =+ vex=(fel tub)
1119− ?~ q.vex
1300+ ?~ q.vex
1120− [p.vex [~ rud tub]]
1302+ [p.vex [~ rud tub]]
1121− =+ wag=$(tub q.u.q.vex)
1303+ $(lef [vex lef], tub q.u.q.vex)
1122− ?> ?=(^ q.wag)
1304+ ::
1305+ :: fold .lef into .wag, combining results with .raq
1308+ |= _[vex=(fel tub) wag=wag] :: q.vex is always (some)
1310+ :- (last p.vex p.wag)
1123− [(last p.vex p.wag) [~ (raq p.u.q.vex p.u.q.wag) q.u.q.wag]]
1311+ [~ (raq p.u.+.q.vex p.u.q.wag) q.u.q.wag]
1126#### Examples
1314#### Examples
1129− > (scan "abc" (stir *@ add prn))
1317+> (scan "abc" (stir *@ add prn))
1132− > (roll "abc" add)
1320+> (roll "abc" add)
@@ -1143,49 +1331,50 @@ Parse bounded number of times.
1144#### Accepts
1332#### Accepts
1146−`[les=@ mos=@]` is a cell of atoms indicating the bounds.
1334+`lig` is a cell of atoms (`[@ @]`) indicating the bounds.
1148−`fel` is a `++rule`.
1336+`fel` is a `rule`.
1150#### Produces
1338#### Produces
1152−A `++rule`.
1340+A `rule`.
1154#### Source
1342#### Source
1157− ++ stun :: parse several times
1345+++ stun
1158− |* {lig/{@ @} fel/rule}
1347+ |* [lig=[@ @] fel=rule]
1159− |= tub/nail
1348+ |= tub=nail
1160− ^- (like (list _(wonk (fel))))
1349+ ^- (like (list _(wonk (fel))))
1161− ?: =(0 +.lig)
1350+ ?: =(0 +.lig)
1162− [p.tub [~ ~ tub]]
1351+ [p.tub [~ ~ tub]]
1163− =+ vex=(fel tub)
1352+ =+ vex=(fel tub)
1164− ?~ q.vex
1353+ ?~ q.vex
1165− ?: =(0 -.lig)
1354+ ?: =(0 -.lig)
1166− [p.vex [~ ~ tub]]
1355+ [p.vex [~ ~ tub]]
1168− =+ ^= wag %= $
1357+ =+ ^= wag %= $
1169− -.lig ?:(=(0 -.lig) 0 (dec -.lig))
1358+ -.lig ?:(=(0 -.lig) 0 (dec -.lig))
1170− +.lig ?:(=(0 +.lig) 0 (dec +.lig))
1359+ +.lig ?:(=(0 +.lig) 0 (dec +.lig))
1171− tub q.u.q.vex
1360+ tub q.u.q.vex
1173− ?~ q.wag
1362+ ?~ q.wag
1175− [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
1364+ [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
1178#### Examples
1367#### Examples
1181− > ((stun [5 10] prn) [1 1] "aquickbrownfoxran")
1370+> ((stun [5 10] prn) [1 1] "aquickbrownfoxran")
1182− [p=[p=1 q=11] q=[~ [p="aquickbrow" q=[p=[p=1 q=11] q="nfoxran"]]]]
1371+[p=[p=1 q=11] q=[~ [p="aquickbrow" q=[p=[p=1 q=11] q="nfoxran"]]]]
1184− > ((stun [5 10] prn) [1 1] "aquickbro")
1373+> ((stun [5 10] prn) [1 1] "aquickbro")
1185− [p=[p=1 q=10] q=[~ [p="aquickbro" q=[p=[p=1 q=10] q=""]]]]
1374+[p=[p=1 q=10] q=[~ [p="aquickbro" q=[p=[p=1 q=10] q=""]]]]
1187− > ((stun [5 10] prn) [1 1] "aqui")
1376+> ((stun [5 10] prn) [1 1] "aqui")
1188− [p=[p=1 q=5] q=~]
1377+[p=[p=1 q=5] q=~]