on master help sign in
Merge pull request #48 from joemfb/arvo-exercises
5d5ce7ecgyarvin
docs/about/contributing.md+1−1
@@ -16,7 +16,7 @@ for improving our [code](https://github.com/urbit/urbit/) and
16Our official guide to contributing can be found
16Our official guide to contributing can be found
17[here](https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md),
17[here](https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md),
18which is most useful for large and low-level changes. For simpler
18which is most useful for large and low-level changes. For simpler
19−revisions, refer to [Hoon Syntax](/hoon/syntax) for an in-depth guide to
19+revisions, refer to [Hoon Syntax](../../hoon/syntax) for an in-depth guide to
20good Hoon. Alternatively, [browse the
20good Hoon. Alternatively, [browse the
21source](https://github.com/urbit/arvo/blob/master/arvo/hoon.hoon).
21source](https://github.com/urbit/arvo/blob/master/arvo/hoon.hoon).
22
22
docs/arvo/basic.md+22−12
@@ -29,8 +29,18 @@ at the [basic operation](/docs/using/admin) of your urbit.
29If you haven't copied in the examples repo, running the following
29If you haven't copied in the examples repo, running the following
30commands from your urbit directory should do the trick:
30commands from your urbit directory should do the trick:
31
31
32−`$ cp -r {wherever-you've-pulled-to}/examples/gall/*/ arvo/`
32+Make sure you've mounted your `%home` desk:
33−`$ cp -r {wherever-you've-pulled-to}/examples/dojo/*/ arvo/`
33+
34+```
35+~fintud-macrep:dojo> |mount %
36+```
37+
38+Then, copy the example into it
39+
40+```
41+$ cp -r {urbit-examples}/gall/*/ {your-pier}/home/
42+$ cp -r {urbit-examples}/dojo/*/ {your-pier}/home/
43+```
34
44
35Run an example to ensure it worked:
45Run an example to ensure it worked:
36
46
@@ -163,7 +173,7 @@ You can write:
163### Lines 12-34
173### Lines 12-34
164
174
165Now let's quickly walk through this code line-by-line. Lines 12-34 are
175Now let's quickly walk through this code line-by-line. Lines 12-34 are
166−wrapped in a `|%` ('[barcen](/hoon/twig/bar-core/cen-core/)'), which produces a core. Cores are a
176+wrapped in a `|%` ('[barcen](../../hoon/twig/bar-core/cen-core/)'), which produces a core. Cores are a
167fundamental datatype in Hoon, similar to a struct, class, or object. A
177fundamental datatype in Hoon, similar to a struct, class, or object. A
168core is just a map of names to any kind of code, whether it be functions
178core is just a map of names to any kind of code, whether it be functions
169or data. Each element in this map begins with a `++` followed by the
179or data. Each element in this map begins with a `++` followed by the
@@ -182,7 +192,7 @@ Let's step into each of the three arms within our core.
182 (add (five a) (three a))
192 (add (five a) (three a))
183 --
193 --
184
194
185−`|=` ('[bartis](/hoon/twig/bar-core/tis-gate/)') produces a function, much like a lambda in lisp. It
195+`|=` ('[bartis](../../hoon/twig/bar-core/tis-gate/)') produces a function, much like a lambda in lisp. It
186takes two children:
196takes two children:
187
197
1881. A set of argument(s). In this case our argument set only contains
1981. A set of argument(s). In this case our argument set only contains
@@ -207,14 +217,14 @@ takes two children:
207As above, `++three` takes an integer argument, `a`, and then executes
217As above, `++three` takes an integer argument, `a`, and then executes
208the remainder of the code with `a` set to the actual arguments.
218the remainder of the code with `a` set to the actual arguments.
209
219
210−Similarly, `=|` ('[tisbar](/hoon/twig/tis-flow/bar-new/)') pushes its first child, `b` into our context
220+Similarly, `=|` ('[tisbar](../../hoon/twig/tis-flow/bar-new/)') pushes its first child, `b` into our context
211(in other words, it declares a variable `b`) and executes the remainder
221(in other words, it declares a variable `b`) and executes the remainder
212of the code. However, `b` is not an argument; `=|` sets `b` to the
222of the code. However, `b` is not an argument; `=|` sets `b` to the
213default value of whatever type it is declared as. Since the default
223default value of whatever type it is declared as. Since the default
214value of an atom is `0`, b is set to `0`.
224value of an atom is `0`, b is set to `0`.
215
225
216−> To produce the default value of any given type, use `$*` ('buctar')
226+> To produce the default value of any given type, use `*` ('tar')
217−> followed by the type. Alternatively, use the irregular form `*`.
227+> followed by the type. This operaction is called *bunt*.
218>
228>
219> > *@ :: produce the default value of atom @
229> > *@ :: produce the default value of atom @
220> 0
230> 0
@@ -225,10 +235,10 @@ value of an atom is `0`, b is set to `0`.
225So now we have two variables: `a` is set to our input, and `b` is
235So now we have two variables: `a` is set to our input, and `b` is
226initialized to `0`.
236initialized to `0`.
227
237
228−One way to think about `|-` ('[barhep](/hoon/twig/bar-core/hep-loop/)') is that it lays down a recursion
238+One way to think about `|-` ('[barhep](../../hoon/twig/bar-core/hep-loop/)') is that it lays down a recursion
229point. More on this later.
239point. More on this later.
230
240
231−`^-` ('[kethep](/hoon/core/ket-cast/hep-cast/)') is just a cast that sets the result of the remainder of
241+`^-` ('[kethep](../../hoon/core/ket-cast/hep-cast/)') is just a cast that sets the result of the remainder of
232the code to an unsigned integer, `@u`.
242the code to an unsigned integer, `@u`.
233
243
234In pseudocode, the last three lines read like this: if `a` is less than
244In pseudocode, the last three lines read like this: if `a` is less than
@@ -246,10 +256,10 @@ function call, then you have to specify every argument.
246
256
247**Exercises**:
257**Exercises**:
248
258
249−Tweak your code to complete the following excercises.
259+Tweak your code to complete the following exercises.
250
260
251There are a few runes and some syntax that we have yet to cover that you
261There are a few runes and some syntax that we have yet to cover that you
252−will need to complete the excercises below. For these, please refer to
262+will need to complete the exercises below. For these, please refer to
253our cheatsheat at the bottom.
263our cheatsheat at the bottom.
254
264
2551. Read and understand `++five` line by line.
2651. Read and understand `++five` line by line.
@@ -272,7 +282,7 @@ our cheatsheat at the bottom.
272 =(a b) test equality
282 =(a b) test equality
273 (function args ...) call function with args
283 (function args ...) call function with args
274
284
275−Lookup each of these expressions (and all others!) in the [Twig Expressions](/hoon/twig/) definition.
285+Lookup each of these expressions (and all others!) in the [Twig Expressions](../../hoon/twig/) definition.
276
286
277### New material
287### New material
278
288
docs/arvo/generators.md+20−24
@@ -65,13 +65,11 @@ optionally specify the message as well.
65We'll need a new mark for our arguments. Let's call it
65We'll need a new mark for our arguments. Let's call it
66`examples-ping-message`.
66`examples-ping-message`.
67
67
68−<blockquote class="blockquote">
69−For app-specific marks, it's good style to prefix the name of
68+> For app-specific marks, it's good style to prefix the name of
70−the mark with the name of the app. Since many apps have
69+> the mark with the name of the app. Since many apps have
71−several such marks, subdirectories in `/mar` are rendered as
70+> several such marks, subdirectories in `/mar` are rendered as
72−`-`, so that `ping-message` is written in
71+> `-`, so that `ping-message` is written in
73−(/mar/examples/ping/message.hoon).
72+> (/mar/examples/ping/message.hoon).
74−</blockquote>
75
73
76```
74```
77:: Up-ness monitor. Accepts atom url, 'on', or 'off'
75:: Up-ness monitor. Accepts atom url, 'on', or 'off'
@@ -214,23 +212,21 @@ text and null.
214Secondly, `?~(a b c)` is a rune which means "if the `a` is null,
212Secondly, `?~(a b c)` is a rune which means "if the `a` is null,
215do `b`, else `c`". It is roughly equivalent to `?:(=(~ a) b c)`.
213do `b`, else `c`". It is roughly equivalent to `?:(=(~ a) b c)`.
216
214
217−<blockquote class="blockquote">
218−`?~(a b c)` is actually equivalent to `?:=(?=(~ a) b c)`,
215+> `?~(a b c)` is actually equivalent to `?:=(?=(~ a) b c)`,
219−which, although identical at run time, is subtly different at
216+> which, although identical at run time, is subtly different at
220−compile time. Specifically, using `?=` rather than `=` means
217+> compile time. Specifically, using `?=` rather than `=` means
221−that we're checking whether `a` is in the *type* of `~`, and so
218+> that we're checking whether `a` is in the *type* of `~`, and so
222−the compiler knows that in the `b` case `a` is null, and in the
219+> the compiler knows that in the `b` case `a` is null, and in the
223−`c` case `a` is not null. Since `=` is purely a runtime value
220+> `c` case `a` is not null. Since `=` is purely a runtime value
224−check with no type implications, the compiler doesn't gain any
221+> check with no type implications, the compiler doesn't gain any
225−information.
222+> information.
226−
223+>
227−At any rate, this is the reason why we can refer to
224+> At any rate, this is the reason why we can refer to
228−`text.message` in the `c` clause. The compiler knows that
225+> `text.message` in the `c` clause. The compiler knows that
229−`message` is not null, so it must have `text` within it. If
226+> `message` is not null, so it must have `text` within it. If
230−you used `?:(=(~ message) 'howdy' text.message)` the compiler
227+> you used `?:(=(~ message) 'howdy' text.message)` the compiler
231−would complain that it doesn't know whether `message` has
228+> would complain that it doesn't know whether `message` has
232−`text` within it.
229+> `text` within it.
233−</blockquote>
234
230
235This is run as follows:
231This is run as follows:
236
232
docs/arvo/http.md+19−29
@@ -77,12 +77,10 @@ line, though.
77Firstly, there's two kinds of cards we're sending to arvo. A
77Firstly, there's two kinds of cards we're sending to arvo. A
78`%them` card makes an HTTP requrest out of a unit `hiss`.
78`%them` card makes an HTTP requrest out of a unit `hiss`.
79
79
80−<blockquote class="blockquote">
81−Recall that `++unit` means "maybe". Formally, "`(unit a)` is
80+> Recall that `++unit` means "maybe". Formally, "`(unit a)` is
82−either null or a pair of null and a value in `a`". Also recall
81+> either null or a pair of null and a value in `a`". Also recall
83−that to pull a value out of a unit `(u.unit)`, you must first
82+> that to pull a value out of a unit `(u.unit)`, you must first
84−verify that the unit is not null (for example with `?~`).
83+> verify that the unit is not null (for example with `?~`).
85−</blockquote>
86
84
87A `hiss` (all of the following terms are defined in `zuse`) is a
85A `hiss` (all of the following terms are defined in `zuse`) is a
88pair of a `purl` and a `moth`. A `purl` is a parsed url
86pair of a `purl` and a `moth`. A `purl` is a parsed url
@@ -96,11 +94,9 @@ of HTTP headers. The `(unit octs)` is a possible octet stream
96representing the body. If it's null, then no body is sent (as in
94representing the body. If it's null, then no body is sent (as in
97this case).
95this case).
98
96
99−<blockquote class="blockquote">
100−An octect stream is a pair of the length in bytes of the data
97+> An octect stream is a pair of the length in bytes of the data
101−plus the data itself. You can use `++taco` takes text and
98+> plus the data itself. You can use `++taco` takes text and
102−turns it into an octet strem.
99+> turns it into an octet strem.
103−</blockquote>
104
100
105When you send this request, you can expect a `%thou` with the
101When you send this request, you can expect a `%thou` with the
106response, which we handle later on in `++thou-request`.
102response, which we handle later on in `++thou-request`.
@@ -108,11 +104,9 @@ response, which we handle later on in `++thou-request`.
108For `%wait`, you just pass a [`@da`]() (absolute date), and arvo will
104For `%wait`, you just pass a [`@da`]() (absolute date), and arvo will
109produce a `%wake` when the time comes.
105produce a `%wake` when the time comes.
110
106
111−<blockquote class="blockquote">
112−A timer is guaranteed to not be triggered before the given
107+> A timer is guaranteed to not be triggered before the given
113−time, but it's currently impossible to guarantee the timer will be
108+> time, but it's currently impossible to guarantee the timer will be
114−triggered at exactly the requested time.
109+> triggered at exactly the requested time.
115−</blockquote>
116
110
117Let's take a look at our state:
111Let's take a look at our state:
118
112
@@ -133,11 +127,9 @@ of `value`, but make the default value be `value`". Thus, our
133type is still a boolean, just like `?`, but the default value is
127type is still a boolean, just like `?`, but the default value is
134`|` (false).
128`|` (false).
135
129
136−<blockquote class="blockquote">
137−This is the same `_` used in `_+>.$`, which means "the same
130+> This is the same `_` used in `_+>.$`, which means "the same
138−type as the value "+>.$". In other words, the same type as our
131+> type as the value "+>.$". In other words, the same type as our
139−current context and state.
132+> current context and state.
140−</blockquote>
141
133
142Let's take a look at `++poke-cord`. When we're poked with a
134Let's take a look at `++poke-cord`. When we're poked with a
143cord, we first check whether it's `'off'`. If so, we set `on` to
135cord, we first check whether it's `'off'`. If so, we set `on` to
@@ -151,14 +143,12 @@ This request follows the pattern in `++hiss` well. `(need (epur
151target))` is the parsed url, `%get` is the HTTP method, `~`
143target))` is the parsed url, `%get` is the HTTP method, `~`
152means no extra headers, and another `~` means no body.
144means no extra headers, and another `~` means no body.
153
145
154−<blockquote class="blockquote">
155−Note the `~` at the end of the move. This is a convenient
146+> Note the `~` at the end of the move. This is a convenient
156−shortcut for creating a list of a single element. It's part of
147+> shortcut for creating a list of a single element. It's part of
157−a small family of such shortcuts. `~[a b c]` is `[a b c ~]`,
148+> a small family of such shortcuts. `~[a b c]` is `[a b c ~]`,
158−`[a b c]~` is `[[a b c] ~]` and `\`[a b c]` is `[~ a b c]`.
149+> `[a b c]~` is `[[a b c] ~]` and `\`[a b c]` is `[~ a b c]`.
159−These may be mixed and matched to create various convoluted
150+> These may be mixed and matched to create various convoluted
160−structures and emojis.
151+> structures and emojis.
161−</blockquote>
162
152
163If the argument is neither 'off' nor 'on', then we assume it's an
153If the argument is neither 'off' nor 'on', then we assume it's an
164actual url, so we save it in `target`.
154actual url, so we save it in `target`.
docs/arvo/internals/eyre/commentary.md+3−3
@@ -96,7 +96,7 @@ initiates the long-polling loop, run against an injected `urb.js` of
96
96
97A `%js` `pest` is `resolve`d as a `text/javascript` success `%this`.
97A `%js` `pest` is `resolve`d as a `text/javascript` success `%this`.
98
98
99−When `poll.js` is recieved by the client, it opens an `XMLHttpRequest` for
99+When `poll.js` is received by the client, it opens an `XMLHttpRequest` for
100`/~/on/{window.urb.poll}.json`, bringing us back to `%poll:process`.
100`/~/on/{window.urb.poll}.json`, bringing us back to `%poll:process`.
101
101
102In the case of a non-`%js` `/~/on/`, `%poll:process-parsed` turns into a
102In the case of a non-`%js` `/~/on/`, `%poll:process-parsed` turns into a
@@ -167,7 +167,7 @@ the first nontrivial `++check-oryx` occurs, `++grab-body` the request oryx and
167ensuring it is recorded for the session. The request parsed with `++need-body`
167ensuring it is recorded for the session. The request parsed with `++need-body`
168to a `[%auth %try {password}]` perk. `%get:process-auth` checks it against
168to a `[%auth %try {password}]` perk. `%get:process-auth` checks it against
169`++load-secret`, upon success updates the session with `++logon:ya`, and
169`++load-secret`, upon success updates the session with `++logon:ya`, and
170−serves a fresh `auth.json` which reflects the changed `user`. Upon recieving
170+serves a fresh `auth.json` which reflects the changed `user`. Upon receiving
171this, the page is refreshed to retry the original request.
171this, the page is refreshed to retry the original request.
172
172
173## Post-authentication: app communication. [#auth-ok]
173## Post-authentication: app communication. [#auth-ok]
@@ -212,7 +212,7 @@ Upon receipt, the client realizes the long-poll isn't actually running, so that
212is started using `urb.poll`. At `/~/of/{ixor}`, perk
212is started using `urb.poll`. At `/~/of/{ixor}`, perk
213`[%view ixor ~ {sequence-number}]`, it is `process`ed by `++poll:ix` (the cyst
213`[%view ixor ~ {sequence-number}]`, it is `process`ed by `++poll:ix` (the cyst
214is retrieved by `++ire-ix` form global state, using the perk `ixor`): the
214is retrieved by `++ire-ix` form global state, using the perk `ixor`): the
215−sequence number is in the past, so the previously recieved `%rush` is
215+sequence number is in the past, so the previously received `%rush` is
216`++give-even`. After deleting the previous message in the queue and invoking
216`++give-even`. After deleting the previous message in the queue and invoking
217`++pass-took` to signal `%gall` of this occurrence, the data is annotated with
217`++pass-took` to signal `%gall` of this occurrence, the data is annotated with
218the source app+path `++subs-to-json`, and returned to the polling duct.
218the source app+path `++subs-to-json`, and returned to the polling duct.
docs/arvo/network.md+32−31
@@ -34,7 +34,8 @@ a value, it prints that value out. To try this out, you have to start
34the app, then you can poke it from the command line with the following
34the app, then you can poke it from the command line with the following
35commands:
35commands:
36
36
37− ~fintud-macrep:dojo> |start %echo
37+ ~fintud-macrep:dojo> |start %examples-echo
38+ 'prep'
38 >=
39 >=
39 ~fintud-macrep:dojo> :examples-echo 5
40 ~fintud-macrep:dojo> :examples-echo 5
40 [%argument 5]
41 [%argument 5]
@@ -57,7 +58,7 @@ do that is to poke it from the command line, which we we did with
57`:echo 5` (`:[app-name] [argument(s)]`).
58`:echo 5` (`:[app-name] [argument(s)]`).
58
59
59In this case, `++poke-noun` takes an argument `arg` and prints it out
60In this case, `++poke-noun` takes an argument `arg` and prints it out
60−with `~&` ([sigpam](/hoon/twig/sig-hint/pam-dump/)). This is an unusual
61+with `~&` ([sigpam](../../hoon/twig/sig-hint/pam-dump/)). This is an unusual
61rune that formally "does nothing", but the interpreter detects it and
62rune that formally "does nothing", but the interpreter detects it and
62printfs the first child, before executing the second as if the first
63printfs the first child, before executing the second as if the first
63didn't exist. This is a slightly hacky way of printing to the console,
64didn't exist. This is a slightly hacky way of printing to the console,
@@ -169,7 +170,7 @@ Run it with these commands:
169
170
170 ~fintud-macrep:dojo> |start %examples-pong
171 ~fintud-macrep:dojo> |start %examples-pong
171 >=
172 >=
172− ~fintud-macrep:dojo> :pong &examples-urbit ~sampel-sipnym
173+ ~fintud-macrep:dojo> :examples-pong &urbit ~sampel-sipnym
173 >=
174 >=
174
175
175Replace `~sampel-sipnym` with another urbit. The easiest thing to do is
176Replace `~sampel-sipnym` with another urbit. The easiest thing to do is
@@ -220,7 +221,7 @@ Let's walk through each of these elements step by step.
220If you look up `++bone` in `hoon.hoon`, you'll see that it's a number
221If you look up `++bone` in `hoon.hoon`, you'll see that it's a number
221(`@ud`), and that it's an opaque reference to a duct. `++duct` in
222(`@ud`), and that it's an opaque reference to a duct. `++duct` in
222hoon.hoon is a list of `wire`s, where `++wire` is an alias for `++path`.
223hoon.hoon is a list of `wire`s, where `++wire` is an alias for `++path`.
223−`++path` is a list of `++span`s, which are ASCII text. Thus, a duct is a
224+`++path` is a list of `++knot`s, which are ASCII text. Thus, a duct is a
224list of paths, and a bone is an opaque reference to it (in the same way
225list of paths, and a bone is an opaque reference to it (in the same way
225that a Unix file descriptor is an opaque reference to a file structure).
226that a Unix file descriptor is an opaque reference to a file structure).
226Thus, to truly understand bones, we must understand ducts.
227Thus, to truly understand bones, we must understand ducts.
@@ -234,7 +235,7 @@ Sometimes, the module can immediately handle the event and produce any
234necessary results. For example, when we poked the `++poke-atom` arm
235necessary results. For example, when we poked the `++poke-atom` arm
235above, we poked %gall, our application server, which was able to respond
236above, we poked %gall, our application server, which was able to respond
236to our poke directly. When the module cannot service the request itself,
237to our poke directly. When the module cannot service the request itself,
237−it sends instructions to another kernel module or application (the the
238+it sends instructions to another kernel module or application (through the
238%gall module) to do a specified action, and produces the result from
239%gall module) to do a specified action, and produces the result from
239that.
240that.
240
241
@@ -283,7 +284,7 @@ The move ends with `*` (that is, any noun) since each type of move takes
283different data. In our case, a `%poke` move takes a target (urbit and
284different data. In our case, a `%poke` move takes a target (urbit and
284app) and marked data, then pokes the arm of the corresponding mark on
285app) and marked data, then pokes the arm of the corresponding mark on
285that app on that urbit with that data. `[to-urbit-address %pong]` is the
286that app on that urbit with that data. `[to-urbit-address %pong]` is the
286−target urbit and app, `%atom` is the mark`, and`'howdy'\` is the data.
287+target urbit and app, `%atom` is the `mark`, and`'howdy'` is the data.
287
288
288When arvo receives a `%poke` move, it calls the appropriate `++poke`.
289When arvo receives a `%poke` move, it calls the appropriate `++poke`.
289The same mechanism is used for sending messages between apps on the same
290The same mechanism is used for sending messages between apps on the same
@@ -304,7 +305,7 @@ urbit as for sending messages between apps on different urbits.
304
305
305- Write two apps, `even` and `odd`. When you pass an atom to `even`,
306- Write two apps, `even` and `odd`. When you pass an atom to `even`,
306 check whether it's even. If so, divide it by two and recurse;
307 check whether it's even. If so, divide it by two and recurse;
307− otherwise, poke `odd` with it. When `odd` recieves an atom, check
308+ otherwise, poke `odd` with it. When `odd` receives an atom, check
308 whether it's equal to one. If so, terminate, printing "%success".
309 whether it's equal to one. If so, terminate, printing "%success".
309 Otherwise, check whether it's odd. If so, multiply it by three, add
310 Otherwise, check whether it's odd. If so, multiply it by three, add
310 one, and recurse; otherwise, poke `even` with it. When either app
311 one, and recurse; otherwise, poke `even` with it. When either app
@@ -312,30 +313,30 @@ urbit as for sending messages between apps on different urbits.
312 the end, you should be able to watch Collatz's conjecture play out
313 the end, you should be able to watch Collatz's conjecture play out
313 between the two apps. Sample output:
314 between the two apps. Sample output:
314
315
315−<!-- -->
316+```
316−
317− ~fintud-macrep:dojo> :even &atom 18
317+~fintud-macrep:dojo> :even &atom 18
318− [%even 18]
318+[%even 18]
319− [%odd 9]
319+[%odd 9]
320− [%even 28]
320+[%even 28]
321− [%even 14]
321+[%even 14]
322− [%odd 7]
322+[%odd 7]
323− [%even 22]
323+[%even 22]
324− [%odd 11]
324+[%odd 11]
325− [%even 34]
325+[%even 34]
326− [%odd 17]
326+[%odd 17]
327− [%even 52]
327+[%even 52]
328− [%even 26]
328+[%even 26]
329− [%odd 13]
329+[%odd 13]
330− [%even 40]
330+[%even 40]
331− [%even 20]
331+[%even 20]
332− [%even 10]
332+[%even 10]
333− [%odd 5]
333+[%odd 5]
334− [%even 16]
334+[%even 16]
335− [%even 8]
335+[%even 8]
336− [%even 4]
336+[%even 4]
337− [%even 2]
337+[%even 2]
338− %success
338+%success
339+```
339
340
340- Put `even` and `odd` on two separate urbits and pass the messages
341- Put `even` and `odd` on two separate urbits and pass the messages
341 over the network. Post a link to a working solution in :talk to
342 over the network. Post a link to a working solution in :talk to
docs/arvo/state.md+10−3
@@ -99,6 +99,13 @@ ever go through the hassle of having to set up and write to a database.
99- Write an app that prints out the previous value you poked it with.
99- Write an app that prints out the previous value you poked it with.
100 Sample output:
100 Sample output:
101
101
102+```
102−\`\`\` \~fintud-macrep:dojo\> :examples-last 7 [%last 0] \>=
103+~fintud-macrep:dojo> :examples-last 7
104+[%last 0]
105+>=
103−\~fintud-macrep:dojo\> :examples-last [1 2 3][%last 7] \>=
106+~fintud-macrep:dojo> :examples-last [1 2 3]
107+[%last 7]
108+>=
104−\~fintud-macrep:dojo\> :examples-last 'howdy' [%last [1 2 3]]
109+~fintud-macrep:dojo> :examples-last 'howdy'
110+[%last [1 2 3]]
111+```
docs/arvo/subject.md+6−6
@@ -15,7 +15,7 @@ Now we're going to cover the boiler plate that we skimmed over earlier.
15 =< (sum [1.000 2.000])
15 =< (sum [1.000 2.000])
16
16
17The first rune, `:-` (colhep, aka
17The first rune, `:-` (colhep, aka
18−[:cons](/hoon/twig/col-cell/hep-cons/)), constructs the 2-element cell
18+[:cons](../../hoon/twig/col-cell/hep-cons/)), constructs the 2-element cell
19that will be our program. The first element, `%say`, tells the
19that will be our program. The first element, `%say`, tells the
20interpreter what to produce--in this case a value.
20interpreter what to produce--in this case a value.
21
21
@@ -28,7 +28,7 @@ Similarly, the rest of the program (which we construct with another
28producing a value of type `noun`, and the code that we run to actually
28producing a value of type `noun`, and the code that we run to actually
29produce our value of the type `noun`.
29produce our value of the type `noun`.
30
30
31−`=<` ([tisgal](/hoon/twig/tis-flow/gal-rap/)) is a rune that takes two
31+`=<` ([tisgal](../../hoon/twig/tis-flow/gal-rap/)) is a rune that takes two
32children. The second child is the context against which we run the first
32children. The second child is the context against which we run the first
33child. So in this case, we are running the expression
33child. So in this case, we are running the expression
34`(sum [1.000 2.000])` against everything contained within the `|%`. In
34`(sum [1.000 2.000])` against everything contained within the `|%`. In
@@ -36,7 +36,7 @@ Hoon, we call the code executed the "formula" and its context the
36"subject".
36"subject".
37
37
38 ::::::::::::::::::::::::::::::
38 ::::::::::::::::::::::::::::::
39− =< (sum [1.000 2.000]) :: formula
39+ =< (sum [1.000 2.000]) :: formula
40 ::::::::::::::::::::::::::::::
40 ::::::::::::::::::::::::::::::
41 |% ::
41 |% ::
42 ++ three ::
42 ++ three ::
@@ -58,8 +58,8 @@ Hoon, we call the code executed the "formula" and its context the
58 (add b $(b (add b 5))) ::
58 (add b $(b (add b 5))) ::
59 ::
59 ::
60 ++ sum ::
60 ++ sum ::
61− |= a/@u ::
61+ |= {a/@u b/@u} ::
62− (add (five a) (three a)) ::
62+ (add (five a) (three b)) ::
63 -- ::
63 -- ::
64 ::::::::::::::::::::::::::::::
64 ::::::::::::::::::::::::::::::
65
65
@@ -72,7 +72,7 @@ allows a sort of reification of the context through continutations, and
72some may see a parallel to Forth's stack, but Hoon takes takes the
72some may see a parallel to Forth's stack, but Hoon takes takes the
73concept one step further.
73concept one step further.
74
74
75−Our starting subject is the [standard library](/hoon/library), which is
75+Our starting subject is the [standard library](../../hoon/library), which is
76defined in `/arvo/hoon.hoon` and `/arvo/zuse.hoon`. This is where
76defined in `/arvo/hoon.hoon` and `/arvo/zuse.hoon`. This is where
77functions like `add` are defined. When we define a core with `|%`, we
77functions like `add` are defined. When we define a core with `|%`, we
78don't throw away the subject (i.e. the standard library); rather, we
78don't throw away the subject (i.e. the standard library); rather, we
docs/arvo/subscriptions.md+11−11
@@ -59,7 +59,7 @@ And secondly, `:examples-sink`:
59 ++ diff-noun
59 ++ diff-noun
60 |= {wir/wire arg/*}
60 |= {wir/wire arg/*}
61 ^- {(list move) _+>.$}
61 ^- {(list move) _+>.$}
62− ~& [%recieved-data arg]
62+ ~& [%received-data arg]
63 [~ +>.$]
63 [~ +>.$]
64 ++ reap
64 ++ reap
65 |= {wir/wire error/(unit tang)}
65 |= {wir/wire error/(unit tang)}
@@ -75,42 +75,42 @@ Cheat sheet:
75
75
76- `&` (pam) can either be the boolean true (as can `%.y`, `0`), or
76- `&` (pam) can either be the boolean true (as can `%.y`, `0`), or
77 the irregular wide form of the `?&`
77 the irregular wide form of the `?&`
78− ([wutpam](/hoon/twig/wut-test/pam-and)) rune, which computes
78+ ([wutpam](../../hoon/twig/wut-test/pam-and)) rune, which computes
79 logical `AND` on its two children.
79 logical `AND` on its two children.
80
80
81- Similar to `&`,`|` is either the boolean false (along with `%.n` and
81- Similar to `&`,`|` is either the boolean false (along with `%.n` and
82 `1`), or the irregular short for of `?|`
82 `1`), or the irregular short for of `?|`
83− ([wutbar](/hoon/twig/wut-test/bar-or)), which computes logical `OR`
83+ ([wutbar](../../hoon/twig/wut-test/bar-or)), which computes logical `OR`
84 on its two children.
84 on its two children.
85
85
86- `!` is the irregular wide form of `?!`
86- `!` is the irregular wide form of `?!`
87− ([wutzap](/hoon/twig/wut-test/zap-not/)), which computes logical
87+ ([wutzap](../../hoon/twig/wut-test/zap-not/)), which computes logical
88 `NOT` on its child.
88 `NOT` on its child.
89
89
90−- `?~` ([wutsig](/hoon/twig/wut-test/sig-ifno/)) is basically an
90+- `?~` ([wutsig](../../hoon/twig/wut-test/sig-ifno/)) is basically an
91 if-then-else that checks whether condition `p` is `~` (null). `?~`
91 if-then-else that checks whether condition `p` is `~` (null). `?~`
92 is slightly different from `?:(~ %tru %fal)` in that `?~` reduces to
92 is slightly different from `?:(~ %tru %fal)` in that `?~` reduces to
93 `?:($=(%type value) %tru %false)`. `$=`
93 `?:($=(%type value) %tru %false)`. `$=`
94− ([buctis](/hoon/twig/buc-mold/tis-coat/)) tests whether value `q` is
94+ ([buctis](../../hoon/twig/buc-mold/tis-coat/)) tests whether value `q` is
95 of type `p`.
95 of type `p`.
96 <!--One thing to watch out for in hoon: if you do `?~`, it
96 <!--One thing to watch out for in hoon: if you do `?~`, it
97 affects the type of the conditional value: XXexample-->
97 affects the type of the conditional value: XXexample-->
98
98
99−- `:_` ([colcab](/hoon/twig/col-cell/cab-scon/)) is inverted `:-`: it
99+- `:_` ([colcab](../../hoon/twig/col-cell/cab-scon/)) is inverted `:-`: it
100 accepts `p` and `q`, and produces `[q p]`.
100 accepts `p` and `q`, and produces `[q p]`.
101
101
102- `++bowl` is the type of the system state within our app. For
102- `++bowl` is the type of the system state within our app. For
103 example, it includes things like `our`, the name of the host urbit,
103 example, it includes things like `our`, the name of the host urbit,
104 and `now`, the current time.
104 and `now`, the current time.
105
105
106−- `$%` ([buccen](/hoon/twig/buc-mold/cen-book/)) is a type
106+- `$%` ([buccen](../../hoon/twig/buc-mold/cen-book/)) is a type
107 constructor: it defines a new type, composed of `n` types that it is
107 constructor: it defines a new type, composed of `n` types that it is
108 passed. For example `$% @ * ^ ==` is the type of either `@`,
108 passed. For example `$% @ * ^ ==` is the type of either `@`,
109 `*`, or a cell `^`. <!--XX this is a union, right?-->
109 `*`, or a cell `^`. <!--XX this is a union, right?-->
110
110
111- You may have noticed the separate `|%`
111- You may have noticed the separate `|%`
112− ([barcen](/hoon/twig/bar-core/cen-core/)) above the application core
112+ ([barcen](../../hoon/twig/bar-core/cen-core/)) above the application core
113− `|_` ([barcab](/hoon/twig/bar-core/cab-door/). We usually put our
113+ `|_` ([barcab](../../hoon/twig/bar-core/cab-door/). We usually put our
114 types in another core on top of the application core. We can access
114 types in another core on top of the application core. We can access
115 these type from our `|_` because in `hoon.hoon` files, all cores are
115 these type from our `|_` because in `hoon.hoon` files, all cores are
116 called against each other. (The shorthand for 'called' is `=>`.)
116 called against each other. (The shorthand for 'called' is `=>`.)
@@ -180,7 +180,7 @@ so you don't have to. You can access your subscribers by looking at
180subscribed, and which path they subscribed on. If you want to
180subscribed, and which path they subscribed on. If you want to
181communicate with your subscribers, send them messages along their bone.
181communicate with your subscribers, send them messages along their bone.
182
182
183−`++poke-noun` "spams" the given arguement to all our subscribers.
183+`++poke-noun` "spams" the given argument to all our subscribers.
184There's a few things we haven't seen before. Firstly, `:_(a b)` is the
184There's a few things we haven't seen before. Firstly, `:_(a b)` is the
185same as `[b a]`. It's just a convenient way of formatting things when
185same as `[b a]`. It's just a convenient way of formatting things when
186the first thing in a cell is much more complicated than the second.
186the first thing in a cell is much more complicated than the second.
docs/arvo/web-apps.md+1−1
@@ -145,7 +145,7 @@ the app from the command line.
145 `:click` and print out the subscription updates on the command
145 `:click` and print out the subscription updates on the command
146 line.
146 line.
147
147
148−#Frontend
148+# Frontend
149
149
150That's all that's needed for the back end. The front end is just
150That's all that's needed for the back end. The front end is just
151some "sail" html (Hoon markup for XML) and javascript. Here's `/web/click.hoon`:
151some "sail" html (Hoon markup for XML) and javascript. Here's `/web/click.hoon`:
docs/hoon/exercises/fizzbuzz.md+2−2
@@ -28,8 +28,8 @@ comments: true
28 ```
28 ```
29
29
30 Modify this to produce "Fuzz" when the number is divisible by
30 Modify this to produce "Fuzz" when the number is divisible by
31− 7, "Fuzz" when divisible by 21, "FuzzFizz" when divisble by 35,
31+ 7, "Fuzz" when divisible by 21, "FuzzFizz" when divisible by 35,
32− and "FuzzFizzBuzz" when divisble by 105.
32+ and "FuzzFizzBuzz" when divisible by 105.
33
33
341. Modify FizzBuzz from the previous exercise to take both a
341. Modify FizzBuzz from the previous exercise to take both a
35 start and an end number.
35 start and an end number.
docs/hoon/library/4h.md+1−1
@@ -61,7 +61,7 @@ Examples
61Parse backslash
61Parse backslash
62
62
63Parses ASCII character 92, the backslash. Note the extra `\` in the calling of
63Parses ASCII character 92, the backslash. Note the extra `\` in the calling of
64−`bas` with [`++just`](/doc/hoon/library/2ec#++just) is to escape the escape
64+`bas` with [`++just`](/docs/hoon/library/2ec#++just) is to escape the escape
65character, `\`.
65character, `\`.
66
66
67Source
67Source
docs/hoon/library/zuse/core/epur.md+1−1
@@ -12,7 +12,7 @@ Parses an entire URL.
12Accepts
12Accepts
13-------
13-------
14
14
15−`a` is a [`++cord`](/doc/hoon/library/1#++cord).
15+`a` is a [`++cord`](/docs/hoon/library/1#++cord).
16
16
17Produces
17Produces
18--------
18--------
docs/hoon/library/zuse/core/yu.md+1−1
@@ -153,7 +153,7 @@ Examples
153Back-shifted leap second dates
153Back-shifted leap second dates
154
154
155Produces a [`++list`]() of absolute dates ([`@da`]()s) that represent the Urbit
155Produces a [`++list`]() of absolute dates ([`@da`]()s) that represent the Urbit
156−Galactc Time equivalents of the UTC leap second dates in [`++les`](/doc/hoon/library/3bc#++les).
156+Galactc Time equivalents of the UTC leap second dates in [`++les`](/docs/hoon/library/3bc#++les).
157
157
158Produces
158Produces
159--------
159--------
docs/hoon/library/zuse/diff.md+1−1
@@ -227,7 +227,7 @@ Examples
227Find common
227Find common
228
228
229Finds a subsequence of repeated elements within two
229Finds a subsequence of repeated elements within two
230−[`++list`](/doc/hoon/library/1#++list)s, producing a [\`++tape]().
230+[`++list`](/docs/hoon/library/1#++list)s, producing a [\`++tape]().
231
231
232Accepts
232Accepts
233-------
233-------
docs/hoon/library/zuse/gate/jesc.md+1−1
@@ -7,7 +7,7 @@ navhome: /docs
7
7
8Escape JSON character
8Escape JSON character
9
9
10−Produces a [`++tape`]() of an escaped [`++json`](/doc/hoon/library/3bi#++json) character `a`.
10+Produces a [`++tape`]() of an escaped [`++json`](/docs/hoon/library/3bi#++json) character `a`.
11
11
12Accepts
12Accepts
13-------
13-------
docs/hoon/library/zuse/gate/tope.md+1−1
@@ -24,7 +24,7 @@ A `++path`.
24 ^- path
24 ^- path
25 [(scot %p p.bem) q.bem (scot r.bem) (flop s.bem)]
25 [(scot %p p.bem) q.bem (scot r.bem) (flop s.bem)]
26
26
27−Parses a [`++beam`]() to a [`++path`](/doc/hoon/library/1#++path).
27+Parses a [`++beam`]() to a [`++path`](/docs/hoon/library/1#++path).
28
28
29 ~zod/try=/zop> (tope [~zod %main ud/1] /hook/down/sur)
29 ~zod/try=/zop> (tope [~zod %main ud/1] /hook/down/sur)
30 /~zod/main/1/sur/down/hook
30 /~zod/main/1/sur/down/hook
docs/hoon/syntax.md+2−2
@@ -371,7 +371,7 @@ long names and/or kebab-case.
371
371
372If you came all this way to learn how to write apps, you're all
372If you came all this way to learn how to write apps, you're all
373set. This is about all you need to know to start getting your
373set. This is about all you need to know to start getting your
374−hands dirty. Refer back here or to the [standard library](/hoon/library) when
374+hands dirty. Refer back here or to the [standard library](../../hoon/library) when
375−needed, but for now, move on to [Arvo](/arvo) to continue learning.
375+needed, but for now, move on to [Arvo](../../arvo) to continue learning.
376
376
377If, however, good enough is *not* enough, feel free to dive deeper:
377If, however, good enough is *not* enough, feel free to dive deeper: