on master help sign in
add !@, !; and !,
e87a97eTinnus Napbus
content/docs/hoon/reference/rune/zap.md+107
@@ -5,6 +5,56 @@ template = "doc.html"
5aliases = ["docs/reference/hoon-expressions/rune/zap/"]
5aliases = ["docs/reference/hoon-expressions/rune/zap/"]
6+++
6+++
7
7
8+## `!,` "zapcom"
9+
10+Produce the Hoon AST of an expression.
11+
12+#### Syntax
13+
14+Two arguments, fixed.
15+
16+Tall form:
17+
18+```hoon
19+!, p
20+q
21+```
22+
23+Wide form:
24+
25+```hoon
26+!,(p q)
27+```
28+
29+Irregular form:
30+
31+None.
32+
33+#### AST
34+
35+```hoon
36+[%zpcm p=hoon q=hoon]
37+```
38+
39+#### Discussion
40+
41+This produces the [`$hoon`](/docs/hoon/reference/stdlib/4o#hoon) AST of
42+expression `q`. The first argument, `p`, is always an example of the `$hoon`
43+type, typically just the `*hoon` bunt value, and is used for type inference. The
44+reason for `p` is just to handle transitions if the `$hoon` type changes.
45+
46+#### Examples
47+
48+```
49+> !, *hoon [1 1]
50+[%cltr p=~[[%sand p=%ud q=1] [%sand p=%ud q=1]]]
51+
52+> !, *hoon (add 1 1)
53+[%cncl p=[%wing p=~[%add]] q=~[[%sand p=%ud q=1] [%sand p=%ud q=1]]]
54+```
55+
56+---
57+
8## `!>` "zapgar"
58## `!>` "zapgar"
9
59
10Wrap a noun in its type (form a [`vase`](/docs/hoon/reference/stdlib/4o#vase)).
60Wrap a noun in its type (form a [`vase`](/docs/hoon/reference/stdlib/4o#vase)).
@@ -118,6 +168,63 @@ nest-fail
118
168
119---
169---
120
170
171+## `!;` "zapmic"
172+
173+Wrap a noun in its type (raw).
174+
175+#### Syntax
176+
177+Two arguments, fixed.
178+
179+Tall form:
180+
181+```hoon
182+!; p
183+q
184+```
185+
186+Wide form:
187+
188+```hoon
189+!;(p q)
190+```
191+
192+Irregular form:
193+
194+None.
195+
196+#### AST
197+
198+```hoon
199+[%zpmc p=hoon q=hoon]
200+```
201+
202+#### Discussion
203+
204+This wraps the product of `q` in its inferred type. It's a raw version of
205+[`!>`](#-zapgar). Unlike zapgar, `q` is not given a `p` face and its type
206+information is not stripped to a raw noun.
207+
208+The first field, `p`, must be an example of the
209+[`$type`](/docs/hoon/reference/stdlib/4o#type) type, typically just `*type` (the
210+bunt of `$type`). The `p` argument is just so transitions can be handled if the
211+`$type` type changes.
212+
213+It's unlikely you'd use this rune directly; [`!>`](#-zapgar) is much more
214+typical.
215+
216+#### Examples
217+
218+```
219+> !; *type [1 1]
220+[#t/[@ud @ud] 1 1]
221+
222+> !; *type 'foo'
223+[#t/@t 'foo']
224+```
225+
226+---
227+
121## `!=` "zaptis"
228## `!=` "zaptis"
122
229
123Make the Nock formula for a Hoon expression.
230Make the Nock formula for a Hoon expression.