on master help sign in
fixing some dojo echoes and chapter references
commit29872da1f4e650633d5444ac2c313a2fa5c88099 authorsyzygyzer <jon.paprocki@tlon.io> dateThu 5 Sep 2019, 12:47 (7 years ago) parent6938c97
1 file changed+3−5
learn/hoon/hoon-tutorial/type-checking-and-type-inference.md+3−5
learn/hoon/hoon-tutorial/type-checking-and-type-inference.md+3−5
@@ -77,7 +77,7 @@ nest-fail
7777
7878### The `.=` and `.+` Runes
7979
80−You saw earlier in the chapter how a type check is performed when `.=` -- or its irregular variant, `=( )` -- is used. For any expression of the form `=(a b)`, either the type of `a` must be a subset of the type of `b` or the type of `b` must be a subset of the type of `a`. Otherwise, the type check fails and you'll get a `nest-fail`.
80+You saw earlier in Chapter 1 how a type check is performed when `.=` -- or its irregular variant, `=( )` -- is used. For any expression of the form `=(a b)`, either the type of `a` must be a subset of the type of `b` or the type of `b` must be a subset of the type of `a`. Otherwise, the type check fails and you'll get a `nest-fail`.
8181
8282```
8383> =(12 [33 44])
@@ -190,13 +190,11 @@ $(a +(a), b (dec b)) :: add a+1 and b-1
190190We run it in the dojo using a cell to pass the two arguments:
191191
192192```
193−> +add [12 14]
193+> (add 12 14)
19419426
195195
196−> +add 22
196+> (add 22)
197197nest-fail
198−-want.{a/@ b/@}
199−-have.@ud
200198```
201199
202200If you try to call this gate with the wrong kind of argument, you get a `nest-fail`. If the call succeeds, then the argument takes on the type of the sample definition: `[a=@ b=@]`. Accordingly, the inferred type of `a` is `@`, and the inferred type of `b` is `@`. In this case some type information has been thrown away; the inferred type of `[12 14]` is `[@ud @ud]`, but the addition program takes all atoms, regardless of aura.