on 492ae2f help sign in
50 lines 957 B history raw
1### `++jest`
3Match a cord
5Match and consume a cord.
7Accepts
8-------
10`daf` is a `@t`.
12Produces
13--------
15An `++edge`.
17Source
18------
20 ++ jest :: match a cord
21 |= daf/@t
22 |= tub/nail
23 =+ fad=daf
24 |- ^- (like @t)
25 ?: =(`@`0 daf)
26 [p=p.tub q=[~ u=[p=fad q=tub]]]
27 ?: |(?=($~ q.tub) !=((end 3 1 daf) i.q.tub))
28 (fail tub)
29 $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 1 daf))
30 ::
32Examples
33--------
35 ~zod/try=> ((jest 'abc') [[1 1] "abc"])
36 [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]]
37 ~zod/try=> (scan "abc" (jest 'abc'))
38 'abc'
39 ~zod/try=> (scan "abc" (jest 'acb'))
40 ! {1 2}
41 ! 'syntax-error'
42 ! exit
43 ~zod/try=> ((jest 'john doe') [[1 1] "john smith"])
44 [p=[p=1 q=6] q=~]
45 ~zod/try=> ((jest 'john doe') [[1 1] "john doe"])
46 [p=[p=1 q=9] q=[~ [p='john doe' q=[p=[p=1 q=9] q=""]]]]
50***