on 492ae2f help sign in
81 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}`, "construct"
38Syntax: *2-fixed*.
40The product: the cell of `p` and `q`, each compiled against
41the subject.
43### `:cont`, `:+`, "collus", `{$cont p/twig q/twig r/twig}`, "cons-3"
45Syntax: *3-fixed*.
47Expands to: `:cons(p :cons(q r))`.
49### `:conq`, `:^`, "colket", `{$cont p/twig q/twig r/twig s/twig}`, "cons-4"
51Syntax: *4-fixed*.
53Expands to: `:cons(p :cont(q r s))`.
55### `:conp`, `:*`, "coltar", `{$conp p/(list twig)}`, "construct tuple"
57Syntax: *running*.
59Expands by: `|-(?~(p ~ ?~(t.p i.p [%cons i.p $(p t.p)])))`.
61### `:conl`, `:~`, "colsig", `{$conl p/(list twig)}`, "construct list"
63Syntax: *running*.
65Expands by: `|-(?~(p [%rock %n ~] [%cons i.p $(p t.p)]))`.
67### `:scon`, `:_`, "colcab", `{$scon p/twig q/twig}`, "construct backward"
69Syntax: *running*.
71Expands to: `[%cons q p]`.
73## Irregular forms
75### Bracket tuple, `[p q r s]`
77Translation:
79```
80[p q r s] :conp(p q r s)
81```