on 492ae2f help sign in
43 lines 773 B history raw
1### `++sear`
3Conditional `++cook`
5Conditional `++cook`. Slams the result through a gate that produces
6a unit; if that unit is empty, fail.
8Accepts
9-------
11`tub` is a `++nail`.
12Produces
13--------
15A `++rule`.
17Source
18------
20 ++ sear :: conditional cook
21 |* {pyq/$-(* (unit)) sef/rule}
22 |= tub/nail
23 =+ vex=(sef tub)
24 ?~ q.vex
25 vex
26 =+ gey=(pyq p.u.q.vex)
27 ?~ gey
28 [p=p.vex q=~]
29 [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]]
30 ::
33Examples
34--------
36 ~zod/try=> ((sear |=(a/* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"])
37 [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
38 ~zod/try=> ((sear |=(* ~) (just 'a')) [[1 1] "abc"])
39 [p=[p=1 q=2] q=~]
43***