on master help sign in
more on tistar, changing examples
4029d9fsyzygyzer
reference/hoon-expressions/rune/lus.md+27−19
@@ -159,12 +159,33 @@ type of lus arm.
159
159
160The primary use of `+*` is to assign aliases to doors (see Examples below).
160The primary use of `+*` is to assign aliases to doors (see Examples below).
161However, they may also be used to define "virtual arms" which behave just like
161However, they may also be used to define "virtual arms" which behave just like
162−ordinary arms except they allow nesting within cores that requires a specific
162+ordinary arms (?) except they allow nesting within cores that requires a specific
163number of arms, such as Gall apps. Put another way, no matter how many virtual
163number of arms, such as Gall apps. Put another way, no matter how many virtual
164arms are defined in a `+*` statement, the interpreter will see it as only being
164arms are defined in a `+*` statement, the interpreter will see it as only being
165a single arm for the purposes of nesting.
165a single arm for the purposes of nesting.
166
166
167−Under the hood, `+*` gets compiled to `=*`.
167+Under the hood, `+*` gets compiled `=*`'s. `+* foo bar` rewrites each `++` arm to include
168+`=* foo bar`. For example, the interpreter sees this Hoon expression
169+
170+```hoon
171+|_ z=@ud
172++* n 1
173+++ x (add z n)
174+++ y (sub z n)
175+--
176+```
177+as being identical to this one:
178+```hoon
179+=| z=@ud
180+|%
181+++ x
182+ =* n 1
183+ (add z n)
184+++ y
185+ =* n 1
186+ (sub z n)
187+--
188+```
168
189
169##### Examples
190##### Examples
170
191
@@ -176,7 +197,8 @@ To assign an alias to a door, we often write the following.
176This is the idomatic way to assign the alias `this` to the door.
197This is the idomatic way to assign the alias `this` to the door.
177
198
178Gall apps have a fixed number of arms, but sometimes you'd like to have more.
199Gall apps have a fixed number of arms, but sometimes you'd like to have more.
179−This is where virtual arms come in.
200+This is where virtual arms come in. We note that it is often better style to
201+compose cores with `=>` or `=<` to add more arms to a Gall app, though.
180
202
181```hoon
203```hoon
182|_ =bowl:gall
204|_ =bowl:gall
@@ -187,22 +209,8 @@ This is where virtual arms come in.
187This assigns the door the alias `this`, the sample of the door `samp`, and the
209This assigns the door the alias `this`, the sample of the door `samp`, and the
188context of the door `cont`.
210context of the door `cont`.
189
211
190−Using more than two arguments for `+*` is unnecessary if you do not care about
191−how many arms your core has. The above snippet has the same behavior as the
192−following one does, except it has more arms:
193
212
194−```hoon
195−|_ foo
196−+* this .
197−+* samp +<
198−+* cont +>
199−```
200
213
201−You are not restricted to lark expressions. Functions may be defined as well.
214+You are not restricted to lark expressions. Functions may be defined as well...
202−Another common snipper seen in Gall apps is the following.
215+(insert example)
203
216
204−```hoon
205−|_ =bowl:gall
206−+* this .
207− def ~(. (default-agent this %|) bowl)
208−```