on 140ac0e help sign in
37 lines 508 B history raw
1### `++fall`
3Give unit a default value
5Produces a default value `b` for a `++unit` `a` in cases where `a` is null.
7Accepts
8-------
10`a` is a unit.
12`b` is a noun that's used as the default value.
14Produces
15--------
17Either a noun `b` or the unwrapped value of unit `a`.
19Source
20------
22 ++ fall :: default
23 |* {a/(unit) b/*}
24 ?~(a b u.a)
27Examples
28--------
30 ~zod/try=> (fall ~ `a`)
31 `a`
32 ~zod/try=> (fall [~ u=0] `a`)
33 0
37***