adds pseudocode and macro expansions to the "advanced" synthetic twigs
commit1459d71c4b0f22c9ecb90ce26b24f429c4f481cf
authorJoseph Bryan <joemfb@gmail.com>
dateThu 23 Jun 2016, 23:47 (10 years ago)
parent4ae54f8
docs/hoon/twig/col-cell/sig-conl.md+21−1
@@ -9,8 +9,28 @@ sort: 5
99
1010## Expands to
1111
12+*Pseudocode*, `a`, `b`, `c`, ... as elements of `p`
13+
14+```
15+:cons(a :cons(b :cons(c :cons(... :cons(z ~)))))
16+```
17+
18+### Compiler Macro
19+
20+```
21+:loop
22+:ifno p
23+ ~
24+:cons i.p
25+:moar(p t.p)
26+```
27+
1228```
13−|-(?~(p ~ :cons(i.p $(p t.p))))
29+|-
30+?~ p
31+ ~
32+:- i.p
33+$(p t.p)
1434```
1535
1636## Syntax
docs/hoon/twig/col-cell/tar-conp.md+25−1
@@ -9,8 +9,32 @@ sort: 4
99
1010## Expands to
1111
12+*Pseudocode*, `a`, `b`, `c`, ... as elements of `p`
13+
14+```
15+:cons(a :cons(b :cons(c :cons(... z)))))
16+```
17+
18+### Compiler Macro
19+
20+```
21+:loop
22+:ifno p
23+ !!
24+:ifno t.p
25+ i.p
26+:cons i.p
27+:moar(p t.p)
28+```
29+
1230```
13−|-(?~(p !! ?~(t.p i.p :cons(i.p $(p t.p)))))
31+|-
32+?~ p
33+ !!
34+?~ t.p
35+ i.p
36+:- i.p
37+$(p t.p)
1438```
1539
1640## Syntax
docs/hoon/twig/sem-make/col-wad.md+23−1
@@ -9,8 +9,30 @@ sort: 3
99
1010## Expands to
1111
12+*Pseudocode*, `a`, `b`, `c`, ... as elements of `q`
13+
14+```
15+:call(p a :call(p b :call(p c ...)))
16+```
17+
18+### Compiler Macro
19+
20+```
21+:loop
22+:ifno q !!
23+:ifno t.q !!
24+:ifno t.t.q
25+ :call(p i.q i.t.q)
26+:call(p i.q :moar(q t.q))
27+```
28+
1229```
13−|-(?~(q !! ?~(t.q !! ?~(t.t.q :call(p i.q i.t.q) :call(p i.q $(q t.q))))))
30+|-
31+?~ q !!
32+?~ t.q !!
33+?~ t.t.q
34+ (p i.q i.t.q)
35+(p i.q $(q t.q))
1436```
1537
1638## Syntax
docs/hoon/twig/tis-flow/fas-var.md+35−1
@@ -10,8 +10,42 @@ noun with the subject.
1010
1111## Expands to
1212
13+*if `p` is a symbol*:
14+
15+```
16+:pin(:name(p q) r)
17+```
18+
19+```
20+=+(^=(p q) r)
21+```
22+
23+*if `p` is a symbol with a mold*:
24+
25+```
26+:pin(:cast(p q) r)
27+```
28+
29+```
30+=+(^-(p q) r)
31+```
32+
33+### Compiler Macro
34+
35+```
36+:ifat p
37+ :pin :name(p q)
38+ r
39+:pin :cast(:coat(p.p q.p) q)
40+r
41+```
42+
1343```
14−?@(p :pin(:name(p q) r) :pin(:cast(:coat(p q) r)
44+?@ p
45+ =+ p=q
46+ r
47+=+ ^-($=(p.p q.p) q)
48+r
1549```
1650
1751## Syntax
docs/hoon/twig/wut-test/bar-or.md+18
@@ -9,7 +9,16 @@ sort: 9
99
1010## Expands to
1111
12+*Pseudocode*, `a`, `b`, `c`, ... as elements of `p`
13+
14+```
15+:if(a & :if(b & :if(c & :if(... :if(z & |)))))
16+```
17+
18+### Compiler Macro
19+
1220```
21+:loop
1322:ifno p
1423 |
1524:if i.p
@@ -17,6 +26,15 @@ sort: 9
1726:moar(p t.p)
1827```
1928
29+```
30+|-
31+?~ p
32+ |
33+?: i.p
34+ &
35+$(p t.p)
36+```
37+
2038## Syntax
2139
2240Regular: *running*.
docs/hoon/twig/wut-test/hep-case.md+23−1
@@ -10,14 +10,36 @@ union, with no default.
1010
1111## Expands to
1212
13+*Pseudocode*, `a`, `b`, `c`, ... as elements of `q`
14+
15+```
16+:if :fits(p.a) q.a
17+:if :fits(p.b) q.b
18+:if :fits(p.c) q.c
19+...
20+:show(%mint-lost !!)
21+```
22+
23+### Compiler Macro
24+
1325```
26+:loop
1427:ifno q
15− :lost
28+ :show(%mint-lost !!)
1629:if :fits(p.i.q p)
1730 q.i.q
1831:moar(q t.q)
1932```
2033
34+```
35+|-
36+?. q
37+ ~|(%mint-lost !!)
38+?: ?=(p.i.q p)
39+ q.i.q
40+$(q t.q)
41+```
42+
2143## Syntax
2244
2345Regular: *1-fixed*, then *jogging*.
docs/hoon/twig/wut-test/lus-deft.md+22
@@ -10,7 +10,20 @@ a union, with a default.
1010
1111## Expands to
1212
13+*Pseudocode*, `a`, `b`, `c`, ... as elements of `r`
14+
15+```
16+:if :fits(p.a) q.a
17+:if :fits(p.b) q.b
18+:if :fits(p.c) q.c
19+...
20+q
21+```
22+
23+### Compiler Macro
24+
1325```
26+:loop
1427:ifno r
1528 q
1629:if :fits(p.i.r p)
@@ -18,6 +31,15 @@ a union, with a default.
1831:moar(r t.r)
1932```
2033
34+```
35+|-
36+?. r
37+ q
38+?: ?=(p.i.r p)
39+ q.i.r
40+$(r t.r)
41+```
42+
2143## Syntax
2244
2345Regular: *2-fixed*, then *jogging*.
docs/hoon/twig/wut-test/pam-and.md+18
@@ -9,7 +9,16 @@ sort: 8
99
1010## Expands to
1111
12+*Pseudocode*, `a`, `b`, `c`, ... as elements of `p`
13+
14+```
15+:lest(a | :lest(b | :lest(c | :lest(... :lest(z | &)))))
16+```
17+
18+### Compiler Macro
19+
1220```
21+:loop
1322:ifno p
1423 &
1524:lest i.p
@@ -17,6 +26,15 @@ sort: 8
1726:moar(p t.p)
1827```
1928
29+```
30+|-
31+?~ p
32+ &
33+?. i.p
34+ |
35+$(p t.p)
36+```
37+
2038## Syntax
2139
2240Regular: *running*.