@@ -4,64 +4,80 @@ weight = 7
4template = "doc.html"
4template = "doc.html"
5aliases = ["docs/reference/hoon-expressions/rune/bar/"]
5aliases = ["docs/reference/hoon-expressions/rune/bar/"]
7Core expressions produce cores. A core is a cell of `[battery payload]`.
8Core expressions produce cores. A core is a cell of `[battery payload]`.
8−The `battery` is code, a battery of Nock formulas. The `payload` is the data
9+The `battery` is code, a battery of Nock formulas. The `payload` is the data
9needed to run those formulas correctly.
10needed to run those formulas correctly.
11−Five core runes (`|=`, `|.`, `|-`, `|*`, and `|$`) produce a
12+Five core runes (`|=`, `|.`, `|-`, `|*`, and `|$`) produce a core with a single
12−core with a single arm, named `$`. As with all arms, we can recompute `$``
13+arm, named `$`. As with all arms, we can recompute `$` with changes, which is
13−with changes, which is useful for recursion among other things.
14+useful for recursion among other things.
15−## Runes
18+Declares a mold builder wet gate with one or more molds as its sample.
17−### |$ "barbuc"
20+#### Syntax
19−Declares a mold builder wet gate with one or more molds as its
22+Two arguments, fixed.
22−##### Syntax
24+Tall form:
26−|$ a=(lest term) b=spec
27+|$ sample
31−[%brbs sample=(lest term) body=spec]
34+|$(sample body)
34−##### Semantics
37+Irregular form:
36−`|$` is used to declare a wet gate mold builder that is polymorphic in its input molds. `a` is a `lest` of `term` used as
39+None.
37−identifiers for the input molds. `b` is a structure built from elements of `a`.
40+
38−The output of `|$` is a mold builder obtained by
41+#### AST
39−substituting the input molds parameterized by `a` into `b`.
42+
44+[%brbc sample=(lest term) body=spec]
41−##### Expands to
47+#### Expands to
49|* [a=$~(* $-(* *)) b=$~(* $-(* *))]
57|* [a=$~(* $-(* *)) b=$~(* $-(* *))]
64+`|$` is used to declare a wet gate mold builder that is polymorphic in its input
65+molds. `a` is a `lest` of `term` used as identifiers for the input molds. `b` is
66+a structure built from elements of `a`. The output of `|$` is a mold builder
67+obtained by substituting the input molds parameterized by `a` into `b`.
54−##### Discussion
69+#### Discussion
56A mold builder is a wet gate from one or more molds to a mold. A mold is a
71A mold builder is a wet gate from one or more molds to a mold. A mold is a
57function from nouns to nouns with types that may be partial, is always
72function from nouns to nouns with types that may be partial, is always
58idempotent, and usually the identity function on the noun itself.
73idempotent, and usually the identity function on the noun itself.
60−`|$` is a restricted form of `|*`. The use of `|$` over `|*` is one of style, as either could
75+`|$` is a restricted form of `|*`. The use of `|$` over `|*` is one of style, as
61−be used to make wet gates that are mold builders. The buc in `|$` is a hint that
76+either could be used to make wet gates that are mold builders. The buc in `|$`
77+is a hint that `|$` is closely related to buc runes, and thus `|$` should be
62−`|$` is closely related to buc runes, and thus `|$` should be used to make mold builders, while `|*` should be used for any other sort of
78+used to make mold builders, while `|*` should be used for any other sort of wet
63−wet gate. Thus, the second argument of `|$` is frequently a buc
79+gate. Thus, the second argument of `|$` is frequently a buc rune. For further
64−rune. For further discussion of wet gates, see the entry for [`|*`](#bartar).
80+discussion of wet gates, see the entry for [`|*`](#-bartar).
66Like other single-arm cores, the arm for `|$` is named `$` and this can be used to
82Like other single-arm cores, the arm for `|$` is named `$` and this can be used to
67define recursive structures. Note however that Hoon is evaluated eagerly, and so
83define recursive structures. Note however that Hoon is evaluated eagerly, and so
@@ -69,26 +85,31 @@ infinite structures are not permitted.
70Proper style for `|$` is to enclose the first argument with brackets, even if it
86Proper style for `|$` is to enclose the first argument with brackets, even if it
71is only a single term. The interpeter will accept a single term without brackets
87is only a single term. The interpeter will accept a single term without brackets
72−just fine, but this style is for consistency with the fact that the first argument is a `lest`.
88+just fine, but this style is for consistency with the fact that the first
74−##### Examples
91+#### Examples
77−~zod:dojo> =foo |$([a b] [b a])
94+> =foo |$([a b] [b a])
79−~zod:dojo> =bar (foo [@ @tas])
96+> =bar (foo [@ @tas])
81−~zod:dojo> (bar %cat 3)
98+> (bar %cat 3)
85−### `|_` "barcab"
104+## `|_` "barcab"
87Produce a **door** (a core with a sample).
106Produce a **door** (a core with a sample).
89−##### Syntax
108+#### Syntax
110+One fixed argument, then a variable number of `+`-family expressions.
91−Regular:
112+Tall form:
@@ -101,21 +122,21 @@ Regular:
102Note: The `++` rune may be replaced with any other rune in the `+` family.
123Note: The `++` rune may be replaced with any other rune in the `+` family.
107−[%brcb p=spec q=alas r=(map term tome)]
110−##### Semantics
129+Irregular form:
112−The product of a `|_` expression is a **door**, a core with one or more arms whose payload includes a sample. That is, a door is a cell of `[battery [sample context]]`, where the `battery` contains one or more arms.
131+None.
114−`a` defines the door sample type and usually includes a name assignment (e.g., `n=@`). `a` is followed by a series of arm definitions, each of which begins with a rune in the `+` family (most of `++`). There must be at least one arm, but there may be arbitrarily many. Each arm must include a name (`b`, `d`, and `f` above), which is followed by the expression (`c`, `e`, and `g` above) that defines the arm product.
133+#### AST
116−The context of the door is the subject of the `|_` expression.
135+```hoon
136+[%brcb p=spec q=alas r=(map term tome)]
118−##### Expands to
139+#### Expands to
@@ -127,29 +148,49 @@ The context of the door is the subject of the `|_` expression.
153+The product of a `|_` expression is a **door**, a core with one or more arms
154+whose payload includes a sample. That is, a door is a cell of `[battery [sample context]]`, where the `battery` contains one or more arms.
156+`a` defines the door sample type and usually includes a name assignment (e.g.,
157+`n=@`). `a` is followed by a series of arm definitions, each of which begins
158+with a rune in the `+` family (most of `++`). There must be at least one arm,
159+but there may be arbitrarily many. Each arm must include a name (`b`, `d`, and
160+`f` above), which is followed by the expression (`c`, `e`, and `g` above) that
161+defines the arm product.
163+The context of the door is the subject of the `|_` expression.
130−##### Discussion
165+#### Discussion
132−A door is the general case of a gate (function). A gate is a
167+A door is the general case of a gate (function). A gate is a door with only one
133−door with only one arm, which has the name `$`.
168+arm, which has the name `$`.
135−Calling a door is like calling a gate except the caller also needs
170+Calling a door is like calling a gate except the caller also needs to specify
171+the arm to be computed. So, for example, if you have some door `door` which
136−to specify the arm to be computed. So, for example, if you have some door `door` which contains some arm `arm`, and you want to pass some argument (i.e., input value `arg`), you would call it with `~(arm door arg)`.
172+contains some arm `arm`, and you want to pass some argument (i.e., input value
173+`arg`), you would call it with `~(arm door arg)`.
138−Because gates are also doors, you can call them the same way. To call the gate `foo` as a door, instead of `(foo baz)` we would write `~($ foo baz)`. This
175+Because gates are also doors, you can call them the same way. To call the gate
176+`foo` as a door, instead of `(foo baz)` we would write `~($ foo baz)`. This is
177+an irregular form for `%~($ foo baz)`,
139−is an irregular form for `%~($ foo baz)`, [%~](/docs/hoon/reference/rune/cen#censig).
178+[%~](/docs/hoon/reference/rune/cen#censig).
141−##### Examples
180+#### Examples
143A trivial door:
182A trivial door:
146−/~zod:dojo> =mol |_ a=@ud
185+> =mol |_ a=@ud
147− ++ succ +(a)
186+ ++ succ +(a)
148− ++ prev (dec a)
187+ ++ prev (dec a)
150−/~zod:dojo> ~(succ mol 1)
190+> ~(succ mol 1)
152−/~zod:dojo> ~(succ mol ~(succ mol ~(prev mol 5)))
193+> ~(succ mol ~(succ mol ~(prev mol 5)))
@@ -172,103 +213,58 @@ The `ne` door prints a digit in base 10, 16, 32 or 64:
175−### `|%` "barcen"
216+---
177−Produce a core, `[battery payload]`.
218+## `|:` "barcol"
179−##### Syntax
220+Produce a gate with a custom sample.
181−Regular:
222+#### Syntax
183−```hoon
224+Two arguments, fixed.
192−Note: The `++` rune may be replaced with any other rune in the `+` family.
197−[%brcn p=(unit term) q=(map term tome)]
202−The product of a `|%` expression is a dry core with one or more arms in the battery.
204−The `|%` rune is followed by a series of arm definitions, each of which begins with a rune in the `+` family (most of `++`). There must be at least one arm, but there may be arbitrarily many. Each arm must include a name (`a`, `c`, and `e` above), which is followed by the expression (`b`, `d`, and `f` above) that defines the arm product.
206−The core payload is the subject of the `|%` expression.
208−##### Discussion
233+Wide form:
210−A core is a cell of `[battery payload]`, where the `battery` is code and the `payload` is data. The `battery` is one or more arms. An arm is a computation that takes the core itself as its subject.
235+```hoon
212−The `|%` rune is used to construct a core from a series of arm definitions. Each arm definition in the expression begins with an arm rune (`++`, `+$`, or `+*`). These arms make up the `battery`. The subject of the `|%` expression is used to make the core's `payload`.
214−A core is like an "object" in a conventional language, but its
215−attributes (_arms_) are functions on the core, not the core and
216−an argument. A "method" on a core is an arm that produces a gate.
223−~zod:dojo> =foo =+ x=58
226− ++ g |= b=@
236+|:(a b)
235−### `|:` "barcol"
239+Irregular form:
237−Produce a gate with a custom sample.
250[%brcl p=hoon q=hoon]
246[%brcl p=hoon q=hoon]
253−##### Semantics
249+#### Semantics
255−`a` is a Hoon expression whose product type defines which values the gate accepts, and it usually includes a name (e.g., `n=1`). The product of `a` also serves as the default value of the sample. `b` is a Hoon expression that determines the product value of the gate.
251+`a` is a Hoon expression whose product type defines which values the gate accepts, and it usually includes a name (e.g., `n=1`). The product of `a` also serves as the default value of the sample. `b` is a Hoon expression that determines the product value of the gate.
257−##### Expands to
253+#### Expands to
264−##### Discussion
260+#### Discussion
266−Pick your own default value for the sample. Note that `a` is an ordinary expression, not a type; `|:` doesn't bunt a sample as
262+Pick your own default value for the sample. Note that `a` is an ordinary
267−[`|=`](#bartis) does.
263+expression, not a type; `|:` doesn't bunt a sample as [`|=`](#bartis) does.
269This is useful if you want a gate to have a sample of a particular type, but you don't want the default value of the gate to be the default value of that type.
265This is useful if you want a gate to have a sample of a particular type, but you don't want the default value of the gate to be the default value of that type.
271−##### Examples
267+#### Examples
274> =add-ten |:(n=`@`2 (add n 10))
270> =add-ten |:(n=`@`2 (add n 10))
@@ -280,137 +276,186 @@ This is useful if you want a gate to have a sample of a particular type, but you
283−### `|.` "bardot"
279+---
285−Produce a trap (a core with one arm `$`).
283+Produce a core, `[battery payload]`.
287−##### Syntax
285+#### Syntax
289−Regular:
287+Argument: a variable number of `+`-family expressions.
292−|. a=hoon
294+++ c=term d=hoon
295−AST:
300+Note: The `++` rune may be replaced with any other rune in the `+` family.
301−##### Semantics
304+None.
303−A `|.` expression produces a core with a single arm, `$`. The core isn't explicitly given a sample. `a` is a Hoon expression that defines the computation of the `$` arm.
306+Irregular form:
305−The payload of the core is the subject of the `|.` expression.
308+None.
307−##### Expands to
310+#### AST
310−|% ++ $ a=hoon
313+[%brcn p=(unit term) q=(map term tome)]
314−##### Discussion
316+#### Semantics
316−A trap is generally used to defer a computation.
318+The product of a `|%` expression is a dry core with one or more arms in the
318−##### Examples
321+The `|%` rune is followed by a series of arm definitions, each of which begins
322+with a rune in the `+` family (most of `++`). There must be at least one arm,
323+but there may be arbitrarily many. Each arm must include a name (`a`, `c`, and
324+`e` above), which is followed by the expression (`b`, `d`, and `f` above) that
325+defines the arm product.
320−A trivial trap:
327+The core payload is the subject of the `|%` expression.
322−```
329+#### Discussion
323−~zod:dojo> =foo |.(42)
325−~zod:dojo> $:foo
331+A core is a cell of `[battery payload]`, where the `battery` is code and the
326−42
332+`payload` is data. The `battery` is one or more arms. An arm is a computation
333+that takes the core itself as its subject.
328−~zod:dojo> (foo)
335+The `|%` rune is used to construct a core from a series of arm definitions. Each
329−42
336+arm definition in the expression begins with an arm rune (`++`, `+$`, or `+*`).
330−```
337+These arms make up the `battery`. The subject of the `|%` expression is used to
338+make the core's `payload`.
332−A more interesting trap:
340+A core is like an "object" in a conventional language, but its attributes
341+(_arms_) are functions on the core, not the core and an argument. A "method" on
342+a core is an arm that produces a gate.
335−~zod:dojo> =foo =/ reps 10
349+> =foo =+ x=58
337− =/ outp 0
351+ ++ n (add 42 x)
339− ?: =(step reps)
353+ (add b n)
341− $(outp (add outp 2), step +(step))
355+
342−~zod:dojo> (foo)
359+> (g.foo 1)
346−Note that we can use `$()` to recurse back into the
363+---
347−trap, since it's a core with an `$` arm.
349−> `$(...)` expands to `%=($ ...)` (["centis"](/docs/hoon/reference/rune/cen#centis)).
365+## `|.` "bardot"
351−### `|-` "barhep"
367+Produce a trap (a core with one arm `$`).
353−Produce a trap (a core with one arm `$`) and evaluate it.
369+#### Syntax
355−##### Syntax
371+One argument, fixed.
357−Regular:
373+Tall form:
366−[%brhp p=hoon]
382+|.(a)
369−##### Semantics
385+Irregular form:
371−A `|-` expression produces a core with one arm named `$` and immediately evaluates `$`. `a` is a Hoon expression that determines what `$` evaluates to.
387+None.
373−##### Expands to
389+#### AST
376−=<($ |.(a=hoon))
392+[%brdt p=hoon]
379−##### Discussion
395+#### Expands to
381−The `|-` rune can be thought of as a 'recursion point' or a 'loop starting point'. Since `|-` makes a `|.` (["bardot"](#bardot), a core with one arm named `$`, we can recurse back into it with `$()`.
397+```hoon
383−> `$(...)` expands to `%=($ ...)` (["centis"](/docs/hoon/reference/rune/cen#centis)).
402+#### Semantics
385−##### Examples
404+A `|.` expression produces a core with a single arm, `$`. The core isn't
405+explicitly given a sample. `a` is a Hoon expression that defines the computation
387−A trivial computation doesn't recurse:
408+The payload of the core is the subject of the `|.` expression.
412+A trap is generally used to defer a computation.
390−~zod:dojo> |-(42)
419+> =foo |.(42)
394−The classic loop is a decrement:
428+A more interesting trap:
397−~zod:dojo> =foo =/ a 42
431+> =foo =/ reps 10
398− =/ b 0
432+ =/ step 0
401− b
435+ ?: =(step reps)
437+ $(outp (add outp 2), step +(step))
403−~zod:dojo> foo
439+> (foo)
443+Note that we can use `$()` to recurse back into the
444+trap, since it's a core with an `$` arm.
446+> `$(...)` expands to `%=($ ...)` (["centis"](/docs/hoon/reference/rune/cen#centis)).
407−### `|^` "barket"
450+## `|^` "barket"
409Produce a core whose battery includes a `$` arm and compute the latter.
452Produce a core whose battery includes a `$` arm and compute the latter.
411−##### Syntax
454+#### Syntax
456+One fixed argument, then a variable number of `+`-family expressions.
413−Regular:
458+Tall form:
@@ -423,17 +468,21 @@ Regular:
424Note: The `++` rune may be replaced with any other rune in the `+` family.
469Note: The `++` rune may be replaced with any other rune in the `+` family.
429−[%brkt p=hoon q=(map term tome)]
474+
430−```
475+Irregular form:
432−##### Semantics
477+None.
434−A `|^` expression produces a multi-arm core whose battery includes a `$` arm, which is evaluated immediately. `a` is a Hoon expression that defines the product of the `$` arm. `a` is followed by a series of arm definitions for the rest of the core battery arms. There must be at least one arm other than the `$` arm.
479+#### AST
482+[%brkt p=hoon q=(map term tome)]
436−##### Expands to
485+#### Expands to
@@ -446,86 +495,194 @@ A `|^` expression produces a multi-arm core whose battery includes a `$` arm, wh
500+A `|^` expression produces a multi-arm core whose battery includes a `$` arm,
501+which is evaluated immediately. `a` is a Hoon expression that defines the
502+product of the `$` arm. `a` is followed by a series of arm definitions for the
503+rest of the core battery arms. There must be at least one arm other than the `$`
449−##### Discussion
506+#### Discussion
451−The `|^` rune is useful when you define a multi-arm core in your code and a particular arm in it is to be evaluated immediately.
508+The `|^` rune is useful when you define a multi-arm core in your code and a
509+particular arm in it is to be evaluated immediately.
453−##### Examples
511+#### Examples
455A trivial example:
513A trivial example:
458−~zod:dojo> |^
516+> |^
459− (add n g)
517+ (add n g)
466−### `|~` "barsig"
524+---
468−Produce an iron gate.
526+## `|-` "barhep"
528+Produce a trap (a core with one arm `$`) and evaluate it.
470−##### Syntax
530+#### Syntax
472−Regular:
532+One argument, fixed.
475−|~ a=spec b=hoon
537+|- a
481−[%brsg p=spec q=hoon]
559+=<($ |.(a=hoon))
564+A `|-` expression produces a core with one arm named `$` and immediately
565+evaluates `$`. `a` is a Hoon expression that determines what `$` evaluates to.
569+The `|-` rune can be thought of as a 'recursion point' or a 'loop starting
570+point'. Since `|-` makes a `|.` (["bardot"](#bardot), a core with one arm named
571+`$`, we can recurse back into it with `$()`.
573+> `$(...)` expands to `%=($ ...)` (["centis"](/docs/hoon/reference/rune/cen#centis)).
577+A trivial computation doesn't recurse:
584+The classic loop is a decrement:
602+Produce an iron gate.
606+Two arguments, fixed.
484−##### Semantics
621+Irregular form:
486−A `|~` expression produces an iron gate. `a` defines the sample, and `b` defines the output value of the gate.
625+#### AST
628+[%brsg p=spec q=hoon]
488−##### Expands to
631+#### Expands to
491^| |=(a b)
634^| |=(a b)
639+A `|~` expression produces an iron gate. `a` defines the sample, and `b` defines
640+the output value of the gate.
494−##### Discussion
642+#### Discussion
496See [this discussion of core variance models](/docs/hoon/reference/advanced)
644See [this discussion of core variance models](/docs/hoon/reference/advanced)
498−##### Examples
646+#### Examples
501−~zod:dojo> => ~ ^+(|~(a=@ *@) |=(a=* *@))
649+> => ~ ^+(|~(a=@ *@) |=(a=* *@))
502<1|usl {a/@ $~}>
650<1|usl {a/@ $~}>
505−### `|*` "bartar"
655+## `|*` "bartar"
507Produce a wet gate (one-armed core with sample).
657Produce a wet gate (one-armed core with sample).
509−##### Syntax
659+#### Syntax
661+Two arguments, fixed.
511−Regular:
663+Tall form:
514−|* a=spec b=hoon
666+|* a b
520−[%brtr p=spec q=hoon]
523−##### Semantics
675+Irregular form:
525−A `|*` expression produces a wet gate. `a` defines the gate's sample, and `b`
679+#### AST
526−is a Hoon expression that determines the output value of the gate.
680+
682+[%brtr p=spec q=hoon]
528−##### Expands to
685+#### Expands to
@@ -535,14 +692,19 @@ is a Hoon expression that determines the output value of the gate.
697+A `|*` expression produces a wet gate. `a` defines the gate's sample, and `b` is
698+a Hoon expression that determines the output value of the gate.
538−##### Discussion
700+#### Discussion
540In a normal (dry) gate, your argument is converted into the
702In a normal (dry) gate, your argument is converted into the
541−sample type. In a generic (wet) gate, your argument type
703+sample type. In a generic (wet) gate, your argument type
542passes through the function, rather as if it were a macro (there
704passes through the function, rather as if it were a macro (there
543is still only one copy of the code, however).
705is still only one copy of the code, however).
545−Genericity is a powerful and dangerous tool. Use wet gates only if
707+Genericity is a powerful and dangerous tool. Use wet gates only if
546you know what you're doing.
708you know what you're doing.
548Just as with a [gate](#bartis), we can recurse back into a wet gate
710Just as with a [gate](#bartis), we can recurse back into a wet gate
@@ -553,50 +715,59 @@ with `$()`.
553`|*` can be used to make wet gates that produce structures, but this usage is
715`|*` can be used to make wet gates that produce structures, but this usage is
554discouraged in favor of `|$`.
716discouraged in favor of `|$`.
556−##### Examples
718+#### Examples
558Wet and dry gates in a nutshell:
720Wet and dry gates in a nutshell:
561−~zod:dojo> =foo |=([a=* b=*] [b a])
723+> =foo |=([a=* b=*] [b a])
563−~zod:dojo> =bar |*([a=* b=*] [b a])
725+> =bar |*([a=* b=*] [b a])
565−~zod:dojo> (foo %cat %dog)
727+> (foo %cat %dog)
566[6.778.724 7.627.107]
728[6.778.724 7.627.107]
568−~zod:dojo> (bar %cat %dog)
730+> (bar %cat %dog)
569[%dog %cat]
731[%dog %cat]
572The dry gate does not preserve the type of `a` and `b`; the wet
734The dry gate does not preserve the type of `a` and `b`; the wet
573gate does.
735gate does.
575−### `|=` "bartis"
739+## `|=` "bartis"
577Produce a gate (a one-armed core with a sample).
741Produce a gate (a one-armed core with a sample).
579−##### Syntax
743+#### Syntax
745+Two arguments, fixed.
581−Regular:
747+Tall form:
584−|= a=spec b=hoon
750+|= a
590−[%brts p=spec q=hoon]
757+|=(a b)
593−##### Definition
760+Irregular form:
595−The product of a `|=` expression is a dry **gate**, i.e., a Hoon function.
762+None.
597−`p` defines the gate sample type -- i.e., the input value type -- and usually includes a sample name assignment (e.g., `a=@`). `q` is an expression that determines the output value of the gate.
764+#### AST
767+[%brts p=spec q=hoon]
599−##### Expands to
770+#### Expands to
@@ -604,7 +775,15 @@ The product of a `|=` expression is a dry **gate**, i.e., a Hoon function.
780+The product of a `|=` expression is a dry **gate**, i.e., a Hoon function.
782+`p` defines the gate sample type -- i.e., the input value type -- and usually
783+includes a sample name assignment (e.g., `a=@`). `q` is an expression that
784+determines the output value of the gate.
607−##### Discussion
786+#### Discussion
609Dry gates are used for the vast majority of ordinary functions in Hoon.
788Dry gates are used for the vast majority of ordinary functions in Hoon.
@@ -612,33 +791,38 @@ A gate is a core with one arm named `$`, so we can recurse back into it with `$(
613> `$(...)` expands to `%=($ ...)` (["centis"](/docs/hoon/reference/rune/cen#centis)).
792> `$(...)` expands to `%=($ ...)` (["centis"](/docs/hoon/reference/rune/cen#centis)).
615−##### Examples
794+#### Examples
617A trivial gate:
796A trivial gate:
620−~zod:dojo> =foo |=(a=@ +(a))
799+> =foo |=(a=@ +(a))
622−~zod:dojo> (foo 20)
801+> (foo 20)
626A slightly less trivial gate:
805A slightly less trivial gate:
629−~zod:dojo> =foo |= [a=@ b=@]
808+> =foo |= [a=@ b=@]
630− (add a b)
809+ (add a b)
631−~zod:dojo> (foo 30 400)
811+> (foo 30 400)
635−### `|@` "barpat"
817+## `|@` "barpat"
637Produce a 'wet' core `[battery payload]`.
819Produce a 'wet' core `[battery payload]`.
639−##### Syntax
821+#### Syntax
641−Regular:
823+Arguments: a variable number of `+`-family expressions.
@@ -651,58 +835,86 @@ Regular:
652Note: The `++` rune may be replaced with any other rune in the `+` family.
836Note: The `++` rune may be replaced with any other rune in the `+` family.
657[%brpt p=(unit term) q=(map term tome)]
849[%brpt p=(unit term) q=(map term tome)]
660−##### Semantics
852+#### Semantics
854+A `|@` expression produces a 'wet' core whose payload is the expression's
855+subject. The various arms in the battery are each named (`a`, `c`, and `e`
856+above) and defined explicitly with a Hoon expression (with `b`, `d`, and `f`
662−A `|@` expression produces a 'wet' core whose payload is the expression's subject. The various arms in the battery are each named (`a`, `c`, and `e` above) and defined explicitly with a Hoon expression (with `b`, `d`, and `f` above).
859+#### Discussion
664−##### Discussion
861+The `|@` rune is just like the `|%` rune except that instead of producing a
862+'dry' core, it produces a 'wet' one. This allows for type polymorphism of its
863+arms, using 'genericity'. See [Advanced types](/docs/hoon/reference/advanced).
666−The `|@` rune is just like the `|%` rune except that instead of producing a 'dry' core, it produces a 'wet' one. This allows for type polymorphism of its arms, using 'genericity'. See [Advanced types](/docs/hoon/reference/advanced).
865+---
668−### `|?` "barwut"
867+## `|?` "barwut"
670Produce a lead trap.
869Produce a lead trap.
672−##### Syntax
871+#### Syntax
674−Regular:
873+One argument, fixed.
683−[%brwt p=hoon]
883+```hoon
686−##### Semantics
887+Irregular form:
688−A `|?` expression produces a lead trap (i.e., a lead core with one arm named `$`). `a` is a Hoon expression that defines what the `$` arm does.
889+None.
690−##### Expands to
897+#### Expands to
905+A `|?` expression produces a lead trap (i.e., a lead core with one arm named
906+`$`). `a` is a Hoon expression that defines what the `$` arm does.
696−##### Discussion
908+#### Discussion
698See this [discussion of the core variance model](/docs/hoon/reference/advanced).
910See this [discussion of the core variance model](/docs/hoon/reference/advanced).
700−##### Examples
912+#### Examples
703−~zod:dojo> => ~ ^+ |?(%a) |.(%a)
915+> => ~ ^+ |?(%a) |.(%a)
704<1?pqz $~>
916<1?pqz $~>
706−~zod:dojo> => ~ ^+ |?(%a) |.(%b)
918+> => ~ ^+ |?(%a) |.(%b)