@@ -80,11 +80,10 @@ implementation of monadic bind. This rune takes a gate `bind` which takes a mold
80##### Desugaring
80##### Desugaring
84− (bind ^:mold)
83+%+ (bind mold)
90##### Discussion
89##### Discussion
@@ -92,13 +91,15 @@ expr1
92`;<` is much like Haskell `do` notation. You have a sequence of events you'd
91`;<` is much like Haskell `do` notation. You have a sequence of events you'd
93like to run such that each past the first depends on the output of the previous
92like to run such that each past the first depends on the output of the previous
94one. The output of the previous one may not be of the correct type to use as an
93one. The output of the previous one may not be of the correct type to use as an
95−input to the next one, and so an adapter such as `+bind` or `+biff` is needed.
94+input to the next one, and so an adapter such as `+biff` is needed.
97`;<` differs from [`;~`](#micsig) in that it takes a gate which takes a mold
96`;<` differs from [`;~`](#micsig) in that it takes a gate which takes a mold
98that produces an implementation of monadic bind, rather than taking an
97that produces an implementation of monadic bind, rather than taking an
99implementation of monadic bind directly.
98implementation of monadic bind directly.
101−`;<` can be used to glue a pipeline together to run an asynchronous function or event. This can be helpful when deferring parts of a computation based on external data.
100+`;<` can be used to glue a pipeline together to run an asynchronous function or
101+event. This can be helpful when deferring parts of a computation based on
103We remark that you can switch binds in the middle of a sequence of `;<`.
104We remark that you can switch binds in the middle of a sequence of `;<`.
@@ -107,12 +108,9 @@ We remark that you can switch binds in the middle of a sequence of `;<`.
107[`+biff`](@/docs/hoon/reference/stdlib/2a/#biff) is the unit monad's
108[`+biff`](@/docs/hoon/reference/stdlib/2a/#biff) is the unit monad's
108implementation of monadic bind. That is to say, it takes a unit `a` and a gate
109implementation of monadic bind. That is to say, it takes a unit `a` and a gate
109`b` that accepts a noun that produces a unit, and extracts the value from `a` to
110`b` that accepts a noun that produces a unit, and extracts the value from `a` to
110−pass as a sample to `b`. [`+bind`](@/docs/hoon/reference/stdlib/2a/#bind) takes
111+pass as a sample to `b`.
111−a unit `a` and a gate `b` that neither accepts nor produces a unit, and applies
112−`b` to the value of `a` and produces a unit. Note that if you do pass `+bind` a
113−gate that produces a unit, `+bind` will treat it as though it does not.
115−We illustrate the usage of `;<`, `+biff`, and `+bind` with a `map` of atoms.
113+We illustrate the usage of `;<` with `+biff` with a `map` of atoms:
117~zod:dojo> =m (my ~[[1 3] [2 2] [3 1]])
115~zod:dojo> =m (my ~[[1 3] [2 2] [3 1]])
118 > (~(get by m) 1)
116 > (~(get by m) 1)
@@ -121,31 +119,16 @@ We illustrate the usage of `;<`, `+biff`, and `+bind` with a `map` of atoms.
121A single usage of `;<` only serves to apply the binding function to the output
119A single usage of `;<` only serves to apply the binding function to the output
122of `expr1`:
120of `expr1`:
124−~zod:dojo> ;< a=@ _bind (~(get by m) 1)
127~zod:dojo> ;< a=@ _biff (~(get by m) 1)
122~zod:dojo> ;< a=@ _biff (~(get by m) 1)
131−Here we see the results of chaining them together:
126+Here we see the result of chaining them together:
133~zod:dojo> ;< a=@ _biff (~(get by m) 1)
128~zod:dojo> ;< a=@ _biff (~(get by m) 1)
134 ;< b=@ _biff (~(get by m) a)
129 ;< b=@ _biff (~(get by m) a)
137−~zod:dojo> ;< a=@ _bind (~(get by m) 1)
138− ;< b=@ _biff (~(get by m) a)
141−~zod:dojo> ;< a=@ _biff (~(get by m) 1)
142− ;< b=@ _bind (~(get by m) a)
145−~zod:dojo> ;< a=@ _bind (~(get by m) 1)
146− ;< b=@ _bind (~(get by m) a)