@@ -10,12 +10,12 @@ Now we've learned enough hoon to do more interesting things.
10Let's get our planets to talk to each other.
10Let's get our planets to talk to each other.
12All we've written up until now are just shell
12All we've written up until now are just shell
13−commands that produce a value and then disappear. To listen for and receive messages from other planets, we'll need an app--let's look at a very simple one:
13+commands that produce a value and then disappear. To listen for and receive messages from other planets, we'll need an app. Let's look at a very simple one:
16:: There is no love that is not an echo
16:: There is no love that is not an echo
18−:::: /hoon/echo/app
18+:::: /hoon/echo/examples/app
@@ -37,10 +37,10 @@ with the following commands:
38~fintud-macrep:dojo> |start %echo
38~fintud-macrep:dojo> |start %echo
40−~fintud-macrep:dojo> :echo 5
40+~fintud-macrep:dojo> :examples-echo 5
41[%argument 5]
41[%argument 5]
43−~fintud-macrep:dojo> :echo [1 2]
43+~fintud-macrep:dojo> :examples-echo [1 2]
44[%argument [1 2]]
44[%argument [1 2]]
@@ -90,7 +90,7 @@ app state is stored. It'll become clear why this is later on,
90but for now pretend that `+>.$` is a magic invocation that means
90but for now pretend that `+>.$` is a magic invocation that means
91"app state".
91"app state".
93−Let's look at another example. Say we want to only accept a
93+Let's look at another example (edit your code in `/app/examples/echo/hoon` to reflect the code below). Say we want to only accept a
94number, and then print out the square of that number.
94number, and then print out the square of that number.
@@ -108,7 +108,7 @@ number, and then print out the square of that number.
109A few things have changed. Firstly, we no longer accept
109A few things have changed. Firstly, we no longer accept
110arbitrary nouns because we can only square atoms (integers, in
110arbitrary nouns because we can only square atoms (integers, in
111−this case an unsigned one). Thus, our argument is now `arg=@`.
111+this case an unsigned one). Thus, our argument is now `arg/@`.
112Secondly, it's `++poke-atom` rather than `++poke-noun`.
112Secondly, it's `++poke-atom` rather than `++poke-noun`.
114# Intro to marks
114# Intro to marks
@@ -136,9 +136,9 @@ commands:
137~fintud-macrep:dojo> |start %square
137~fintud-macrep:dojo> |start %square
139−~fintud-macrep:dojo> :square 6
139+~fintud-macrep:dojo> :examples-square 6
140gall: %square: no poke arm for noun
140gall: %square: no poke arm for noun
141−~fintud-macrep:dojo> :square &atom 6
141+~fintud-macrep:dojo> :examples-square &atom 6
142[%square 36]
142[%square 36]
@@ -149,14 +149,14 @@ gall: %square: no poke arm for noun
149Marks are powerful, and they're the backbone of urbit's data
149Marks are powerful, and they're the backbone of urbit's data
150pipeline, so we'll be getting quite used to them.
150pipeline, so we'll be getting quite used to them.
152−**Exercises**:
152+**Exercise**:
154- Write an app that computes fizzbuzz on its input (as in the
154- Write an app that computes fizzbuzz on its input (as in the
155 previous section).
155 previous section).
157# Sending a message to another ship
157# Sending a message to another ship
159−Let's write our first network message! Here's `/app/pong.hoon`:
159+Let's write our first network message! Here's `/app/examples/pong.hoon`:
@@ -184,15 +184,15 @@ Let's write our first network message! Here's `/app/pong.hoon`:
184Run it with these commands:
184Run it with these commands:
187−~fintud-macrep:dojo> |start %pong
187+~fintud-macrep:dojo> |start %examples-pong
189−~fintud-macrep:dojo> :pong &urbit ~sampel-sipnym
189+~fintud-macrep:dojo> :pong &examples-urbit ~sampel-sipnym
193Replace `~sampel-sipnym` with another urbit. The easiest thing to
193Replace `~sampel-sipnym` with another urbit. The easiest thing to
194do is to start a [moon](), a sub-identity of your urbit. Don't
194do is to start a [moon](), a sub-identity of your urbit. Don't
195−forget to start the `%pong` app on that urbit too. You should
195+forget to start the `%examples-pong` app on that urbit too. You should
196see, on the foreign urbit, this output:
196see, on the foreign urbit, this output:
@@ -230,21 +230,22 @@ The general form of a move is
231-arvo part---->
231-arvo part---->
232`[bone term wire *]`
232`[bone term wire *]`
233− >-app/vane-specific part of move
234+------------------------->app/vane-specific part of move
235Or, in pseudo-code:
236Or, in pseudo-code:
237`["cause" sys-call/action tack-new-layer-on-cause action-specific
238`["cause" sys-call/action tack-new-layer-on-cause action-specific
238information]`
239information]`
240−Let's walk through each of these elements step by step
241+Let's walk through each of these elements step by step.
242#### Bones ("cause")
243#### Bones ("cause")
244If you look up `++bone` in `hoon.hoon`, you'll see that it's a
245If you look up `++bone` in `hoon.hoon`, you'll see that it's a
245number (`@ud`), and that it's an opaque reference to a duct.
246number (`@ud`), and that it's an opaque reference to a duct.
246−`++duct` in hoon.hoon is a list of `wire`s, where `wire` is an
247+`++duct` in hoon.hoon is a list of `wire`s, where `++wire` is an
247−alias for `path`. `++path` is a list of `span`s, which are ASCII
248+alias for `++path`. `++path` is a list of `++span`s, which are ASCII
248text. Thus, a duct is a list of paths, and a bone is an opaque
249text. Thus, a duct is a list of paths, and a bone is an opaque
249reference to it (in the same way that a Unix file
250reference to it (in the same way that a Unix file
250descriptor is an opaque reference to a file structure). Thus, to
251descriptor is an opaque reference to a file structure). Thus, to
@@ -331,7 +332,7 @@ anything with this information right now, but we could.
331- Extend either of the apps in the first two exercises to accept
332- Extend either of the apps in the first two exercises to accept
332 input over the network in the same way as `pong`.
333 input over the network in the same way as `pong`.
334−- Modify `pong` to print out a message when it receives acknowledgement.
335+- Modify `examples-pong` to print out a message when it receives acknowledgement.
336- Write two apps, `even` and `odd`. When you pass an atom to
337- Write two apps, `even` and `odd`. When you pass an atom to
337 `even`, check whether it's even. If so, divide it by two and
338 `even`, check whether it's even. If so, divide it by two and