@@ -13,6 +13,40 @@ product-sample adapter.
13The gates in `q` connected together using the gate `p`, which
13The gates in `q` connected together using the gate `p`, which
14transforms a `q` product and a `q` gate into a `q` sample.
14transforms a `q` product and a `q` gate into a `q` sample.
18+*Note: these are structurally correct, but elide some type-system complexity.*
20+`;~(a b)` reduces to `b`.
22+`;~(a b c)` expands to
29+`;~(a b c d)` expands to
35+|. (a (c arg) d(+6 arg))
47+|. (p (b c) a(,.+6 c))
16## Discussion
50## Discussion
18Apparently `:dip` is a "Kleisli arrow." Whatevs. It's also
52Apparently `:dip` is a "Kleisli arrow." Whatevs. It's also
@@ -22,6 +56,11 @@ so you don't need to either.
23`:dip` is often used in parsers, but is not only for parsers.
57`:dip` is often used in parsers, but is not only for parsers.
59+This can be thought of as user-defined function composition; instead of simply
60+nesting the gates in `q`, each is passed individually to `p` with the product
61+of the previous gate, allowing arbitrary filtering, transformation, or
62+conditional application.
27Regular: *1-fixed*, then *running*.
66Regular: *1-fixed*, then *running*.
@@ -32,9 +71,9 @@ A simple "parser." `trip` converts a `cord` (atomic string) to
32a `tape` (linked string).
71a `tape` (linked string).
35−~zod:dojo> =cmp |=({a/tape b/$-(char tape)] `tape`?~(a ~ (weld (b i.a) t.a)))
74+~zod:dojo> =cmp |=({a/tape b/$-(char tape)} `tape`?~(a ~ (weld (b i.a) t.a)))
36~zod:dojo> ;~(cmp trip)
75~zod:dojo> ;~(cmp trip)
37−<1.xef [a=@ <374.hzt 100.kzl 1.ypj %164>]>
76+<1.zje {a/@ <409.yxa 110.lxv 1.ztu $151>}>
38~zod:dojo> (;~(cmp trip) 'a')
77~zod:dojo> (;~(cmp trip) 'a')