on master help sign in
thru ?
commit454b23aa654988855866fbdebffbbdbd5caa70be authorHenry Ault <henry@tlon.io> dateWed 30 Mar 2016, 19:34 (11 years ago) parent050e818
13 files changed+74−415
docs/system/hoon/runes/wt/wtbr.md+5−29 docs/system/hoon/runes/wt/wtcl.md+5−25 docs/system/hoon/runes/wt/wtdt.md+11−32 docs/system/hoon/runes/wt/wtgl.md+3−28 docs/system/hoon/runes/wt/wtgr.md+4−30 docs/system/hoon/runes/wt/wthp.md+10−43 docs/system/hoon/runes/wt/wtkt.md+7−30 docs/system/hoon/runes/wt/wtls.md+10−55 docs/system/hoon/runes/wt/wtpm.md+6−30 docs/system/hoon/runes/wt/wtpt.md+2−32 docs/system/hoon/runes/wt/wtsg.md+3−28 docs/system/hoon/runes/wt/wtts.md+5−25 docs/system/hoon/runes/wt/wtzp.md+3−28
docs/system/hoon/runes/wt/wtbr.md+5−29
@@ -1,40 +1,16 @@
1−`?| wutbar`
2−====
1+# `:or`, `?|`, "wutbar" `{$or p/(list twig)}`
32
43Logical 'or'.
54
65Computes the logical 'or' operation on a list of boolean expressions `p`.
76
8−Produces
9−--------
7+Regular form: *running*
108
11−Twig: `[%wtbr p=tusk]`
9+Irregular form:
1210
13−Accepts
14−-------
11+`?(a b c) ?|(a b c)`
1512
16−`p` is a [`++tusk`](), a list of [`++twig`]()s.
17−
18−Tall form
19−---------
20−
21− ?| i.p
22− i.t.p
23− i.t.t.p
24− ==
25−
26−Wide form
27−---------
28−
29− ?|(i.p i.t.p i.t.t.p)
30−
31−Irregular form
32−--------------
33−
34− |(i.p i.t.p i.t.t.p)
35−
36−Examples
37−--------
13+Examples:
3814
3915 ~zod/try=> ?|(& |)
4016 %.y
docs/system/hoon/runes/wt/wtcl.md+5−25
@@ -1,32 +1,12 @@
1−`?: wutcol`
2−====
1+# `if`, `?:`, "wutcol" `{$if p/twig q/twig r/twig}`
32
43If-then-else.
54
6−Produces
7−--------
5+If `p` evaluates to true, then `q`. Else, `e`.
86
9−Twig: `[%wtcl p=twig q=twig r=twig]`
7+Regular form: *3-fixed*
108
11−Accepts
12−-------
13−
14−`p`, `q`, and `r` are [`++twig`]()s.
15−
16−Tall form
17−---------
18−
19− ?: p
20− q
21− r
22−
23−Wide form
24−---------
25−
26− ?:(p q r)
27−
28−Examples
29−--------
9+Examples:
3010
3111 ~zod/try=> ?:((gth 1 2) 1 2)
3212 2
@@ -34,5 +14,5 @@ Examples
3414 %yup
3515
3616Here we see two common cases of `?:` in the wide form, one uses an
37−expression [`++gte`]() that produces a boolean and the other [`?=`]() to
17+expression `++gte` that produces a boolean and the other `?=` to
3818produce one of its cases.
docs/system/hoon/runes/wt/wtdt.md+11−32
@@ -1,45 +1,24 @@
1−`?. wutdot`
2−====
1+# `:lest`, `?.`, "wutdot" `{$lest p/twig q/twig r/twig}`
32
43Inverted if-then-else.
54
6−Unless `p` is true, evaluate `r`. Used to keep the heavier of `q` and `r` as the bottom expression, which makes for more readable code (see the section on [backstep]()).
5+Unless `p` is true, evaluate `r`. Used to keep the heavier of `q` and `r` as the bottom expression, which makes for more readable code (see the section on backstep in the syntax section).
76
8−Produces
9−--------
7+Regular form: *3-fixed*
108
11−Twig: `[%wtdt p=twig q=twig r=twig]`
12−
13−Accepts
14−-------
15−
16−`p`, `q`, and `r` are [`++twig`]()s.
17−
18−Tall form
19−---------
20−
21− ?. p
22− q
23− r
24−
25−Wide form
26−---------
27−
28− ?.(p q r)
29−
30−Examples
31−--------
9+Examples:
3210
3311 ~zod/try=> ?.((gth 1 2) 1 2)
3412 1
3513 ~zod/try=> ?.(?=(%a 'a') %not-a %yup)
3614 %yup
15+ > ?. %.y
16+ 'this false case is less heavy than the true case'
17+ ?: =(2 3)
18+ 'two not equal to 3'
19+ 'but see how \'r is much heavier than \'q?'
20+ 'but see how \'r is much heavier than \'q?'
3721
3822Here we see two common cases of `?.` in the wide form, one uses an
39−expression `gth` that produces a boolean and the other [`?=`]() to
23+expression `gth` that produces a boolean and the other `?=` to
4024produce one of its cases.
41−
42−Equivalent to
43−-------------
44−
45− ?:(p r q)
docs/system/hoon/runes/wt/wtgl.md+3−28
@@ -1,40 +1,15 @@
1−`?< wutgal`
1+# `:deny`, `?<`, "wutgal" `{$deny p/twig q/twig}`
22====
33
44Assert `p` is false.
55
66Asserts that `p` is false before evaluating `q`. Crashes if `p` evaluates to false.
77
8−Produces
9−--------
8+Regular form: *2-fixed*
109
11−Twig: `[%wtgl p=twig q=twig]`
12−
13−Accepts
14−-------
15−
16−`p` and `q` are [`++twig`]()s.
17−
18−Tall form
19−---------
20−
21− ?< p
22− q
23−
24−Wide form
25−---------
26−
27− ?<(p q)
28−
29−Examples
30−--------
10+Examples:
3111
3212 ~zod/try=> ?<(=(0x1 0) %foo)
3313 %foo
3414 ~zod/try=> ?<(=(0x1 1) %foo)
3515 ! exit
36−
37−Equivalent to
38−-------------
39−
40− ?:(p !! q)
docs/system/hoon/runes/wt/wtgr.md+4−30
@@ -1,40 +1,14 @@
1−`?> wutgar`
2−====
1+# `:sure`, `?>`, "wutgar" `{$sure p/twig q/twig}`
32
43Assert `p` is true.
54
6−Asserts that `p` is true before evaluating `q`. Crashes if `p` evaluates to true.
5+Asserts that `p` is true before evaluating `q`, crashing if `p` evaluates to false.
76
8−Produces
9−--------
7+Regular form: *2-fixed*
108
11−Twig: `[%wtgr p=twig q=twig]`
12−
13−Accepts
14−-------
15−
16−`p` and `q` are [`++twig`]()s.
17−
18−Tall form
19−---------
20−
21− ?> p
22− q
23−
24−Wide form
25−---------
26−
27− ?>(p q)
28−
29−Examples
30−--------
9+Examples:
3110
3211 ~zod/try=> ?>(=(0x1 1) %foo)
3312 %foo
3413 ~zod/try=> ?>(=(0x1 0) %foo)
3514 ! exit
36−
37−Equivalent to
38−-------------
39−
40− ?.(p !! q)
docs/system/hoon/runes/wt/wthp.md+10−43
@@ -1,52 +1,19 @@
1−`?- wuthep`
2−====
1+# `:case`, `?-`, "wuthep" `{$case p/wing q/(list (pair twig twig))}`
32
43Switch.
54
6−Different from the traditional switch statement in that it switches on a type instead of a value. More specifically, the labels in `q` must match the [span]() of `p`. `q` must be terminated with a `==`.
5+Switches on the value of `p`. `q` is a list of key value pairs, the heads of
6+which `p` attempts to match with. Different from the traditional switch
7+statement in that it switches on a type instead of a value. XX take a close
8+look at this description The most common type used to switch on is the cube,
9+which begins with `%` followed by text.
710
8−Produces
9−--------
11+Regular form: *1-fixed, followed by jogging*
1012
11−Twig: `[%wthp p=wing q=tine]`
12−
13−Accepts
14−-------
15−
16−`p` is a [`++wine`](). `q` is a [`++tine`]().
17−
18−Tall form
19−---------
20−
21−Kingside:
22−
23− ?- p
24− p.i.q q.i.q
25− p.i.t.q q.i.t.q
26− p.i.t.t.q q.i.t.t.q
27− ==
28−
29−Queenside:
30−
31− ?- p
32− p.i.q
33− q.i.q
34− p.i.t.q
35− q.i.t.q
36− p.i.t.t.q
37− q.i.t.t.q
38− ==
39−
40−Wide form
41−---------
42−
43− ?-(p p.i.q q.i.q, p.i.t.q q.i.t.q, p.i.t.t.q q.i.t.t.q)
44−
45−Examples
46−--------
13+Examples:
4714
4815 ~zod/try=>
49− =cor |= typ=$?(%a %b)
16+ =cor |= typ/$?(%a %b)
5017 ?- typ
5118 %a 1
5219 %b 2
@@ -62,7 +29,7 @@ Examples
6229Here is a simple example of `?-` that thows its input must have a well
6330defined type for which all of the cases are covered. We create a core,
6431`cor`, that takes an input `typ` which must be either `%a` or `%b` with
65−[`$%`](). Calling `cor` with valid arguments selects one of our cases.
32+`$%`. Calling `cor` with valid arguments selects one of our cases.
6633
6734 ~zod/try=>
6835 ?- 'a'
docs/system/hoon/runes/wt/wtkt.md+7−30
@@ -1,32 +1,13 @@
1−`?^ wutket`
1+# `:ifcl`, `?^`, "wutket" `{$ifcl p/wing q/twig r/twig}`
22====
33
44If `p` is cell-then-else.
55
6−Produces
7−--------
6+If `p` is a cell, then produce `q`. Else, produce `r`.
87
9−Twig: `[%wtkt p=wing q=twig r=twig]`
8+Regular form: *3-fixed*
109
11−Accepts
12−-------
13−
14−`p` is a [`++wing`](). `q` and `r` are [`++twig`]()s.
15−
16−Tall form
17−---------
18−
19− ?^ p
20− q
21− r
22−
23−Wide form
24−---------
25−
26− ?^(p q r)
27−
28−Examples
29−--------
10+Examples:
3011
3112 ~zod/try=> =(*@tas "")
3213 %.y
@@ -39,8 +20,8 @@ Examples
3920 %empty
4021 %full
4122
42−Here we show that `*@tas`, the [bunt]() of `@tas` is equivalent to the empty
43−[`++tape`]() `""`, then use it in two `?^` cases.
23+Here we show that `*@tas`, the bunt of `@tas` is equivalent to the empty
24+`++tape` `""`, then use it in two `?^` cases.
4425
4526 ~zod/try=> *(unit)
4627 ~
@@ -53,10 +34,6 @@ Here we show that `*@tas`, the [bunt]() of `@tas` is equivalent to the empty
5334 %empty
5435 %full
5536
56−Similar to the above case, we show the bunt of a [`++unit`](), which is
37+Similar to the above case, we show the bunt of a `++unit`, which is
5738`~`, and test against it.
5839
59−Equivalent to
60−-------------
61−
62− ?:(?=(^ p) q r)
docs/system/hoon/runes/wt/wtls.md+10−55
@@ -1,56 +1,21 @@
1−`?+ wutlus`
2−====
1+# `:defl`, `?+`, "wutlus" `{$deft p/wing q/twig r/(list (pair twig twig))}`
32
4−Switch w/default value.
3+Switch with default value.
54
6−Identical to [`?-`]() except for that it takes a default case `q` if none of the cases in `r` match the type of `p`. More specifically, the labels in `q` must match the [span]() of `p`. `q` must be terminated with a `==`.
5+Identical to `?-` except for that it takes a default case `q` if none of the
6+cases in `r` match the type of `p`. More specifically, the labels in `q` must
7+match the span of `p`. As with `?-`, the most common type used to switch on is the cube, which begins with `%` followed by text.
78
8−As with `?-`, the most common type used to switch on is the [cube](), which begins with `%` followed by text.
9+Examples:
910
10−Produces
11−--------
12−
13−Twig: `[%wtls p=wing q=twig r=tine]`
14−
15−Accepts
16−-------
17−
18−`p` is a [`++wing`](). `q` is a [`++twig`](). `r` is a [`++tine`]().
19−
20−Tall form
21−---------
22−
23−Kingside:
24−
25− ?+ p
26− q
11+ ?- p
2712 p.i.r q.i.r
2813 p.i.t.r q.i.t.r
2914 p.i.t.t.r q.i.t.t.r
15+ * q
3016 ==
31−
32−Queenside:
33−
34− ?+ p
35− q
36− p.i.r
37− q.i.r
38− p.i.t.r
39− q.i.t.r
40− p.i.t.t.r
41− q.i.t.t.r
42− ==
43−
44−Wide form
45−---------
46−
47− ?+(p q p.i.r q.i.r, p.i.t.r q.i.t.r, p.i.t.t.r q.i.t.t.r)
48−
49−Examples
50−--------
51−
5217 ~zod/try=>
53− =cor |= typ=@ta
18+ =cor |= typ/@ta
5419 ?+ typ 0
5520 %a 1
5621 %b 2
@@ -64,7 +29,7 @@ Examples
6429 0
6530
6631Here is a simple example of `?+` showing that although the cases must
67−match the [span]() of its input, all possible cases don't need to be covered
32+match the span of its input, all possible cases don't need to be covered
6833since `?+` has a default case. We create a core, `cor` that takes an
6934input `typ`, a `@ta`. Calling `cor` selects one of our cases when it is
7035covered, or the default.
@@ -92,13 +57,3 @@ covered, or the default.
9257
9358This example shows how `?+` can fail. Our input span must match the span
9459of our cases.
95−
96−Equivalent to
97−-------------
98−
99− ?- p
100− p.i.r q.i.r
101− p.i.t.r q.i.t.r
102− p.i.t.t.r q.i.t.t.r
103− * q
104− ==
docs/system/hoon/runes/wt/wtpm.md+6−30
@@ -1,40 +1,16 @@
1−`?& wutpam`
2−====
1+# `:and`, `?&`, "wutpam" `{$and p/(list twig)}`
32
43Logical 'and'.
54
6−Computes the logical 'and' operation on a list of boolean expressions.
5+Computes the logical 'and' operation on a list of boolean expressions `p`.
76
8−Produces
9−--------
7+Regular form: *running*
108
11−Twig: `[%wtpm p=tusk]`
9+Irregular form:
1210
13−Accepts
14−-------
11+`&(a b c) ?&(a b c)`
1512
16−`p` is a [`++tusk`](), a list of [++twig]()s.
17−
18−Tall form
19−---------
20−
21− ?& i.p
22− i.t.p
23− i.t.t.p
24− ==
25−
26−Wide form
27−---------
28−
29− ?&(i.p i.t.p i.t.t.p)
30−
31−Irregular form
32−--------------
33−
34− &(i.p i.t.p i.t.t.p)
35−
36−Examples
37−--------
13+Examples:
3814
3915 ~zod/try=> ?&(& &)
4016 %.y
docs/system/hoon/runes/wt/wtpt.md+2−32
@@ -1,36 +1,10 @@
1−`?@ wutpat`
2−====
1+# `:ifat`, `?&`, "wutpam" `{$ifat p/wing q/twig r/twig}`
32
43If atom-then-else.
54
65If-then-else statement that tests whether `p` is an atom, producing `q` if true and `r` if false.
76
8−Produces
9−--------
10−
11−Twig: `[%wtpt p=wing q=twig r=twig]`
12−
13−Accepts
14−-------
15−
16−`p` is a [`++wing`](). `q` and `r` are [++twig]()s.
17−
18−Tall form
19−---------
20−
21−Kingside:
22−
23− ?@ p
24− q
25− r
26−
27−Wide form
28−---------
29−
30− ?@(p q r)
31−
32−Examples
33−--------
7+Examples:
348
359 ~zod/try=> ?@(~ 1 2)
3610 ! mint-vain
@@ -47,7 +21,3 @@ Examples
4721 ~zod/try=> ?@(`*`[1 1] 1 2)
4822 2
4923
50−Equivalent to
51−-------------
52−
53− ?:(?=(@ p) q r)
docs/system/hoon/runes/wt/wtsg.md+3−28
@@ -1,4 +1,4 @@
1−`?~ wutsig`
1+# `ifno`, `?~`, "wutsig" `{$ifno p/wing q/twig r/twig}`
22====
33
44If-null-then-else.
@@ -6,30 +6,9 @@ If-null-then-else.
66If-then-else statement that tests whether `p` is null, producing `q` if true
77and `r` if false.
88
9−Produces
10−--------
9+Regular form: *3-fixed*
1110
12−Twig: `[%wtsg p=wing q=twig r=twig]`
13−
14−Accepts
15−-------
16−
17−`p` is a [`++wing`](). `q` and `r` are [`++twig`]()s.
18−
19−Tall form
20−---------
21−
22− ?~ p
23− q
24− r
25−
26−Wide form
27−---------
28−
29− ?~(p q r)
30−
31−Examples
32−--------
11+Examples:
3312
3413 ~zod/try=> ?~('a' 1 2)
3514 2
@@ -40,7 +19,3 @@ Examples
4019 ~zod/try=> ?~((sub 20 20) 1 2)
4120 1
4221
43−Equivalent to
44−-------------
45−
46− ?:(?=(~ p) q r)
docs/system/hoon/runes/wt/wtts.md+5−25
@@ -1,33 +1,13 @@
1−`?= wuttis`
1+# `:ifits`, `?=`, "wuttis" `{$fits p/twig q/wing}
22====
33
4−Is `q` within `++span` `p`.
4+Is `q` within type `p`.
55
6−Tests whether `q` is of type (mold) `p`.
6+Tests whether `q` is of mold `p`.
77
8−Produces
9−--------
8+Regular form: *2-fixed*
109
11−Twig: `[%wtts p=mold q=wing]`
12−
13−Sample
14−------
15−
16−`p` is a mold], `q` is a [`++wing`]().
17−
18−Tall form
19−---------
20−
21− ?= p
22− q
23−
24−Wide form
25−---------
26−
27− ?=(p q)
28−
29−Examples
30−--------
10+Examples:
3111
3212 ~zod/try=> ?=(@ 'a')
3313 %.y
docs/system/hoon/runes/wt/wtzp.md+3−28
@@ -1,37 +1,12 @@
1−`?! wutzap`
2−====
1+# `:not`, `?!`, "wutzap" `{$not p/twig}`
32
43Logical not.
54
65Produces the logical "not" of `p`.
76
8−Produces
9−--------
7+Regular form: *1-fixed*
108
11−Twig: `[%wtzp p=twig]`
12−
13−Accepts
14−-------
15−
16−`p` is a [`++twig`]().
17−
18−Tall form
19−---------
20−
21− ?! p
22−
23−Wide form
24−---------
25−
26− ?!(p)
27−
28−Irregular form
29−--------------
30−
31− !p
32−
33−Examples
34−--------
9+Examples:
3510
3611 ~zod/try=> !&
3712 %.n