@@ -13,6 +13,40 @@ product-sample adapter.
1313The gates in `q` connected together using the gate `p`, which
1414transforms a `q` product and a `q` gate into a `q` sample.
1515
16+## Expands to
17+
18+*Note: these are structurally correct, but elide some type-system complexity.*
19+
20+`;~(a b)` reduces to `b`.
21+
22+`;~(a b c)` expands to
23+
24+```
25+|= arg/*
26+(a (b arg) c(+6 arg))
27+```
28+
29+`;~(a b c d)` expands to
30+
31+```
32+|= arg/*
33+%+ a (b arg)
34+=+ arg=arg
35+|. (a (c arg) d(+6 arg))
36+```
37+
38+### Compiler macro
39+
40+```
41+?~ q !!
42+|-
43+?~ t.q i.q
44+=/ a $(q t.q)
45+=/ b i.q
46+=/ c ,.+6.b
47+|. (p (b c) a(,.+6 c))
48+```
49+
1650## Discussion
1751
1852Apparently `:dip` is a "Kleisli arrow." Whatevs. It's also
@@ -22,6 +56,11 @@ so you don't need to either.
2256
2357`:dip` is often used in parsers, but is not only for parsers.
2458
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.
63+
2564## Syntax
2665
2766Regular: *1-fixed*, then *running*.
@@ -32,9 +71,9 @@ A simple "parser." `trip` converts a `cord` (atomic string) to
3271a `tape` (linked string).
3372
3473```
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)))
3675~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>}>
3877~zod:dojo> (;~(cmp trip) 'a')
3978"a"
4079```