on master help sign in
minor edits, one comment
86dfcefsyzygyzer
learn/hoon/hoon-tutorial/molds.md+7−9
@@ -4,17 +4,17 @@ weight = 0
4template = "doc.html"
4template = "doc.html"
5+++
5+++
6
6
7−A mold is
7+A mold is a
8+[//]: # (You should finish this thought :P)
8
9
9−Let's take some examples from `hoon.hoon`. `|$` is a new rune as of the writing of this document so you may see this spelled in slightly different way if you don't have the latest version of `hoon.hoon`.
10+Let's take some examples from `hoon.hoon`. `|$` is a new rune as of the writing of this document so you may see this spelled in slightly different way if you don't have the latest version of `hoon.hoon`. `|$` is the mold builder rune which takes a list of molds and produces a mold.
10
11
11```
12```
12++ pair
13++ pair
13 |$ [head tail]
14 |$ [head tail]
14 [p=head q=tail]
15 [p=head q=tail]
15```
16```
16−
17−Here is a very simple mold builder. It takes two molds and produces a mold that is a pair of those with the faces `p` and `q`. `|$` is the mold builder rune which takes a list of molds and produces a mold. An example of using this would be `(pair @ud @ud)` which would produce a mold for a cell of `@ud` and `@ud`.
17+Here is a very simple mold builder. It takes two molds and produces a mold that is a pair of those with the faces `p` and `q`. An example of using this would be `(pair @ud @ud)` which would produce a mold for a cell of `@ud` and `@ud`.
18
18
19```
19```
20++ each
20++ each
@@ -24,14 +24,13 @@ Here is a very simple mold builder. It takes two molds and produces a mold that
24 ==
24 ==
25```
25```
26
26
27−`each` is very slightly more complicated than `pair` was but not by much. `$%` is a rune that is a tagged union. The mold produced by this will match either `this` or `that`. An example of this would be `(each @ud @tas)` which will match either an `@ud` or a `@tas`.
27+`++each` is very slightly more complicated than `pair`. `$%` is a rune that is a tagged union. The mold produced by this will match either `this` or `that`. An example of this would be `(each @ud @tas)` which will match either an `@ud` or a `@tas`.
28
28
29```
29```
30++ list
30++ list
31 |$ [item]
31 |$ [item]
32 $@(~ [i=item t=(list item)])
32 $@(~ [i=item t=(list item)])
33```
33```
34−
35Here is a mold builder you've used previously. `$@` is a rune that will match the first thing if it's sample is an atom and the second if the sample is a cell. You should be familiar at this point that a `list` is either `~` or a pair of an item and a list of item.
34Here is a mold builder you've used previously. `$@` is a rune that will match the first thing if it's sample is an atom and the second if the sample is a cell. You should be familiar at this point that a `list` is either `~` or a pair of an item and a list of item.
36
35
37
36
@@ -40,8 +39,7 @@ Here is a mold builder you've used previously. `$@` is a rune that will match th
40 |$ [item]
39 |$ [item]
41 [i/item t/(list item)]
40 [i/item t/(list item)]
42```
41```
43−
44−`lest` you may have heard of as a "non empty list." You can see that it lacks the `~` case that `list` has but it matches the second part of the `list` definition. Remember that Hoon types are defined by shape. `list` could also have been defined in terms of `lest` like this
42+`lest` you may have heard of as a "non empty list." You can see that it lacks the `~` case that `list` has but it matches the second part of the `list` definition. Remember that Hoon types are defined by shape. `list` could also have been defined in terms of `lest` like this:
45
43
46```
44```
47++ list
45++ list
@@ -57,4 +55,4 @@ Another possible way to write it could have been
57 $@(~ [i=item t=$])
55 $@(~ [i=item t=$])
58```
56```
59
57
60−Any of these would be equivalent.
58+Any of these would be equivalent.