on 140ac0e help sign in
41 lines 641 B history raw
1### `++bind`
3Non-unit function to unit, producing unit
5Applies a function `b` to the value (`u.a`) of a ++unit `a`, producing
6a unit. Used when you want a function that does not accept or produce a
7unit to both accept and produce a unit.
9Accepts
10-------
12`a` is a unit.
14`b` is a function.
16Produces
17--------
19A unit.
21Source
22------
24 ++ bind :: argue
25 |* {a/(unit) b/gate}
26 ?~ a ~
27 [~ u=(b u.a)]
30Examples
31--------
33 ~zod/try=> (bind ((unit @) [~ 97]) ,@t)
34 [~ `a`]
35 ~zod/try=> =a |=(a/@ (add a 1))
36 ~zod/try=> (bind ((unit @) [~ 2]) a)
37 [~ 3]
41***