on 3fee830 help sign in
83 lines 1.7 kB history raw
1---
2sort: 4
3---
5# Cell construction (`:` runes)
7The cell twigs, `$cons` and friends, are simple and regular.
8All `:` twigs expand to `$cons`.
10## Twigs
12```
13|%
14++ twig
15 {$scon p/twig q/twig}
16 {$conq p/twig q/twig r/twig s/twig}
17 {$cons p/twig q/twig}
18 {$cont p/twig q/twig r/twig}
19 {$conl p/(list twig)}
20 {$conp p/(list twig)}
21--
22```
24All construction stems expand to one natural stem, `$cons`, the
25pair constructor, named for the Lisp special form.
27Synthetic stems change the last letter to indicate the bulb type:
28`$cont` for triple, `$conq` for quad, `$conp` for tuple, `$conl`
29for list. `$scon` is the reverse.
31## Regular forms
33The rune prefix is `:`. Suffixes: `-` for pair, `+` for triple,
34`^` for quad, `*` for tuple, `~` for list, `_` for reverse.
36### `:cons`, `:-`, "colhep", `{$cons p/twig q/twig}`,
38*Construct a cell (2-tuple*).
40Syntax: *2-fixed*.
42The product: the cell of `p` and `q`, each compiled against
43the subject.
45### `:cont`, `:+`, "collus", `{$cont p/twig q/twig r/twig}`,
47Syntax: *3-fixed*.
49Expands to: `:cons(p :cons(q r))`.
51### `:conq`, `:^`, "colket", `{$cont p/twig q/twig r/twig s/twig}`,
53Syntax: *4-fixed*.
55Expands to: `:cons(p :cont(q r s))`.
57### `:conp`, `:*`, "coltar", `{$conp p/(list twig)}`,
59Syntax: *running*.
61Expands by: `|-(?~(p ~ ?~(t.p i.p [%cons i.p $(p t.p)])))`.
63### `:conl`, `:~`, "colsig", `{$conl p/(list twig)}`, "construct list"
65Syntax: *running*.
67Expands by: `|-(?~(p [%rock %n ~] [%cons i.p $(p t.p)]))`.
69### `:scon`, `:_`, "colcab", `{$scon p/twig q/twig}`, "construct backward"
71Syntax: *running*.
73Expands to: `[%cons q p]`.
75## Irregular forms
77### Bracket tuple, `[p q r s]`
79Translation:
81```
82[p q r s] :conp(p q r s)
83```