on master help sign in
spacing issues
752a7acjoshuareagan
docs/tutorials/gall/network.umd+98−98
@@ -13,24 +13,24 @@ In the following we assume that you have some knowledge of Hoon. If you don't,
13Let's get our planets to talk to each other. To listen for and receive messages from other planets, we'll need an app. Let's look at a very simple one, `echo.hoon`:
13Let's get our planets to talk to each other. To listen for and receive messages from other planets, we'll need an app. Let's look at a very simple one, `echo.hoon`:
14
14
15```
15```
16− :: Accepts any noun from dojo and prints it out
16+:: Accepts any noun from dojo and prints it out
17− ::
17+::
18− :::: /===/app/echo/hoon
18+:::: /===/app/echo/hoon
19− ::
19+ ::
20− !: :: enables debug printfs
20+!: :: enables debug printfs
21− |% :: forms a core with subject as payload
21+|% :: forms a core with subject as payload
22− +$ move [bone card] :: defines echo app's arvo move mold
22++$ move [bone card] :: defines echo app's arvo move mold
23− +$ card $% $~ :: defines card (data) mold as null tagged union
23++$ card $% $~ :: defines card (data) mold as null tagged union
24− == :: end of mold definition; see $%
24+ == :: end of mold definition; see $%
25− -- :: end of card arm definition
25+-- :: end of card arm definition
26− :: ::
26+:: ::
27− |_ [bow=bowl:gall $~] :: forms a core with bowl (app state) as sample
27+|_ [bow=bowl:gall $~] :: forms a core with bowl (app state) as sample
28− ++ poke-noun :: begin definition of poke-noun arm
28+++ poke-noun :: begin definition of poke-noun arm
29− |= non=* :: forms a gate which accepts any noun
29+ |= non=* :: forms a gate which accepts any noun
30− ^- [(list move) _+>.$] :: casts product to mold of moves and context
30+ ^- [(list move) _+>.$] :: casts product to mold of moves and context
31− ~& echo+noun+non :: debug printf, i.e. '[%echo %noun *]'
31+ ~& echo+noun+non :: debug printf, i.e. '[%echo %noun *]'
32− [~ +>.$] :: produce a cell of empty list and our state
32+ [~ +>.$] :: produce a cell of empty list and our state
33− -- :: end of poke-noun arm definition
33+-- :: end of poke-noun arm definition
34```
34```
35
35
36This is a very simple app that does only one thing. If you poke it with
36This is a very simple app that does only one thing. If you poke it with
@@ -39,19 +39,19 @@ the app, then you can poke it from the command line with the following
39commands:
39commands:
40
40
41```
41```
42− ~fintud-macrep:dojo> |start %echo
42+~fintud-macrep:dojo> |start %echo
43− >=
43+>=
44+
44− ~fintud-macrep:dojo> :echo 5
45+~fintud-macrep:dojo> :echo 5
45− [%echo %noun 5]
46+[%echo %noun 5]
46− >=
47+>=
48+
47− ~fintud-macrep:dojo> :echo [1 2]
49+~fintud-macrep:dojo> :echo [1 2]
48− [%echo %noun [1 2]]
50+[%echo %noun [1 2]]
49− >=
51+>=
50```
52```
51
53
52−> There is currently a bug where the `[%echo %noun *]` lines are printed *above*
54+> There is currently a bug where the `[%echo %noun *]` lines are printed *above* the line you entered, so your output may not look exactly like this. `>=` means that a command was successfully received and executed.
53−> the line you entered, so your output may not look exactly like this. `>=`
54−> means that a command was successfully received and executed.
55
55
56Most of the app code should be simple enough to guess its function. The
56Most of the app code should be simple enough to guess its function. The
57important part of this code is the definition of `++poke-noun`.
57important part of this code is the definition of `++poke-noun`.
@@ -90,29 +90,29 @@ Let's look at another example (edit your code in
90only accept a number, and then print out the square of that number.
90only accept a number, and then print out the square of that number.
91
91
92```
92```
93− :: Accepts an atom from the dojo and squares it.
93+:: Accepts an atom from the dojo and squares it.
94− ::
94+::
95− :::: /===/app/square/hoon
95+:::: /===/app/square/hoon
96− ::
96+ ::
97− !:
97+!:
98− |% :: no moves in :square
98+|% :: no moves in :square
99− +$ move [bone card] :: no cards in :square
99++$ move [bone card] :: no cards in :square
100− +$ card $% $~
100++$ card $% $~
101− ==
101+ ==
102− --
102+--
103− :: :: stateless
103+:: :: stateless
104− |_ [bow=bowl:gall $~]
104+|_ [bow=bowl:gall $~]
105− ++ poke-atom
105+++ poke-atom
106− |= tom=@
106+ |= tom=@
107− ^- [(list move) _+>.$]
107+ ^- [(list move) _+>.$]
108− ~& square+(mul tom tom)
108+ ~& square+(mul tom tom)
109− [~ +>.$]
109+ [~ +>.$]
110− --
110+--
111```
111```
112
112
113A few things have changed. Firstly, we no longer accept arbitrary nouns because
113A few things have changed. Firstly, we no longer accept arbitrary nouns because
114we can only square atoms (integers, in this case an unsigned one). Thus, our
114we can only square atoms (integers, in this case an unsigned one). Thus, our
115−argument is now `tom/@`. Secondly, it's `++poke-atom` rather than `++poke-noun`.
115+argument is now `tom=@`. Secondly, it's `++poke-atom` rather than `++poke-noun`.
116
116
117## Intro to marks
117## Intro to marks
118
118
@@ -135,13 +135,15 @@ expecting an atom, so we have to explicitly mark the data with `atom`
135using `&[mark]`. Try the following commands:
135using `&[mark]`. Try the following commands:
136
136
137```
137```
138− ~fintud-macrep:dojo> |start %square
138+~fintud-macrep:dojo> |start %square
139− >=
139+>=
140+
140− ~fintud-macrep:dojo> :square 6
141+~fintud-macrep:dojo> :square 6
141− gall: %square: no poke arm for noun
142+gall: %square: no poke arm for noun
143+
142− ~fintud-macrep:dojo> :square &atom 6
144+~fintud-macrep:dojo> :square &atom 6
143− [%square 36]
145+[%square 36]
144− >=
146+>=
145```
147```
146
148
147> Recall the bug where `%square` may get printed above the input line.
149> Recall the bug where `%square` may get printed above the input line.
@@ -158,48 +160,49 @@ so we'll be getting quite used to them.
158Let's write our first network message! Here's `examples/app/pong.hoon`:
160Let's write our first network message! Here's `examples/app/pong.hoon`:
159
161
160```
162```
161− :: Allows one urbit to send the string 'Pong' to
163+:: Allows one urbit to send the string 'Pong' to
162− :: another urbit.
164+:: another urbit.
163− ::
165+::
164− :::: /===/app/pong/hoon
166+:::: /===/app/pong/hoon
165− ::
167+ ::
166− !:
168+!:
167− |%
169+|%
168− +$ move [bone card]
170++$ move [bone card]
169− +$ card $% [$poke wire dock poke-contents]
171++$ card $% [$poke wire dock poke-contents]
170− ==
172+ ==
171− +$ poke-contents $% [$atom @]
173++$ poke-contents $% [$atom @]
172− ==
174+ ==
173− --
175+--
174− |_ [bow=bowl:gall $~] :: stateless
176+|_ [bow=bowl:gall $~] :: stateless
175− ::
177+::
176− ++ poke-urbit
178+++ poke-urbit
177− |= to=ship
179+ |= to=ship
178− ^- [(list move) _+>.$]
180+ ^- [(list move) _+>.$]
179− ~& pong+'Outgoing pong!'
181+ ~& pong+'Outgoing pong!'
180− :_ +>.$
182+ :_ +>.$
181− ~[[ost.bow %poke /sending [to dap.bow] %atom 'Pong']]
183+ ~[[ost.bow %poke /sending [to dap.bow] %atom 'Pong']]
182− ::
184+::
183− ++ poke-atom
185+++ poke-atom
184− |= tom=@
186+ |= tom=@
185− ^- [(list move) _+>.$]
187+ ^- [(list move) _+>.$]
186− ~& pong+'Incoming pong!'
188+ ~& pong+'Incoming pong!'
187− ~& pong+received+`@t`tom
189+ ~& pong+received+`@t`tom
188− [~ +>.$]
190+ [~ +>.$]
189− ::
191+::
190− ++ coup |=(* [~ +>.$])
192+++ coup |=(* [~ +>.$])
191− ::
193+::
192− --
194+--
193```
195```
194
196
195
197
196Run it with these commands:
198Run it with these commands:
197
199
198```
200```
199− ~fintud-macrep:dojo> |start %pong
201+~fintud-macrep:dojo> |start %pong
200− >=
202+>=
203+
201− ~fintud-macrep:dojo> :pong &urbit ~sampel-sipnym
204+~fintud-macrep:dojo> :pong &urbit ~sampel-sipnym
202− >=
205+>=
203```
206```
204
207
205Replace `~sampel-sipnym` with another urbit. The easiest thing to do is to start
208Replace `~sampel-sipnym` with another urbit. The easiest thing to do is to start
@@ -209,8 +212,8 @@ the `%pong` app on that urbit, too. You should see, on the foreign
209urbit, this output:
212urbit, this output:
210
213
211```
214```
212− [%pong 'Incoming pong!']
215+[%pong 'Incoming pong!']
213− [%pong %received 'Pong']
216+[%pong %received 'Pong']
214```
217```
215
218
216Most of the code should be straightforward. In `++poke-atom`, the only new thing
219Most of the code should be straightforward. In `++poke-atom`, the only new thing
@@ -227,7 +230,7 @@ do anything in particular. Now we want to send a message to another urbit. Thus,
227we produce a list with one element:
230we produce a list with one element:
228
231
229```
232```
230− ~[[ost.bow %poke /sending [to dap.bow] %atom 'Pong]]
233+~[[ost.bow %poke /sending [to dap.bow] %atom 'Pong]]
231```
234```
232
235
233### Moves
236### Moves
@@ -309,10 +312,7 @@ When Arvo receives a `%poke` move, it calls the appropriate `++poke`.
309The same mechanism is used for sending messages between apps on the same
312The same mechanism is used for sending messages between apps on the same
310urbit as for sending messages between apps on different urbits.
313urbit as for sending messages between apps on different urbits.
311
314
312−> We said earlier that we're not expecting a response. This is not
313−> entirely true: the `++coup` is called when we receive acknowledgment
315+> We said earlier that we're not expecting a response. This is not entirely true: the `++coup` is called when we receive acknowledgment that the `++poke` was called. We don't do anything with this information right now, but we could.
314−> that the `++poke` was called. We don't do anything with this
315−> information right now, but we could.
316
316
317*Exercises*:
317*Exercises*:
318
318
docs/tutorials/gall/state.umd+51−57
@@ -14,50 +14,52 @@ Let's build a trivial stateful app. It'll keep a running the sum of all the
14atoms we poke it with. Here's `examples/app/sum.hoon`:
14atoms we poke it with. Here's `examples/app/sum.hoon`:
15
15
16```
16```
17− :: Keeps track of the sum of all the atoms it has been
17+:: Keeps track of the sum of all the atoms it has been
18− :: poked with and prints the sum out
18+:: poked with and prints the sum out
19− ::
19+::
20− :::: /===/app/sum/hoon
20+:::: /===/app/sum/hoon
21− ::
21+ ::
22− !:
22+!:
23− |%
23+|%
24− +$ move [bone card]
24++$ move [bone card]
25− +$ card $% $~
25++$ card $% $~
26− ==
26+ ==
27− --
27+--
28− |_ [bow=bowl:gall sum=@]
28+|_ [bow=bowl:gall sum=@]
29− ::
29+::
30− ++ poke-atom
30+++ poke-atom
31− |= tom=@
31+ |= tom=@
32− ^- [(list move) _+>.$]
32+ ^- [(list move) _+>.$]
33− ~& sum+(add sum tom)
33+ ~& sum+(add sum tom)
34− [~ +>.$(sum (add sum tom))]
34+ [~ +>.$(sum (add sum tom))]
35− ::
35+::
36− ++ coup
36+++ coup
37− |= [wir=wire err=(unit tang)]
37+ |= [wir=wire err=(unit tang)]
38− ^- [(list move) _+>.$]
38+ ^- [(list move) _+>.$]
39− ?~ err
39+ ?~ err
40− ~& sum+success+'Poke succeeded!'
40+ ~& sum+success+'Poke succeeded!'
41+ [~ +>.$]
42+ ~& sum+error+'Poke failed. Error:'
43+ ~& sum+error+err
41 [~ +>.$]
44 [~ +>.$]
42− ~& sum+error+'Poke failed. Error:'
43− ~& sum+error+err
44− [~ +>.$]
45− ::
45+::
46− --
46+--
47```
47```
48
48
49We can start it with `|start %sum`, and then run it:
49We can start it with `|start %sum`, and then run it:
50
50
51```
51```
52− ~fintud-macrep:dojo> :sum &atom 5
52+~fintud-macrep:dojo> :sum &atom 5
53− [%sum 5]
53+[%sum 5]
54− >=
54+>=
55+
55− ~fintud-macrep:dojo> :sum &atom 2
56+~fintud-macrep:dojo> :sum &atom 2
56− [%sum 7]
57+[%sum 7]
57− >=
58+>=
59+
58− ~fintud-macrep:dojo> :sum &atom 15
60+~fintud-macrep:dojo> :sum &atom 15
59− [%sum 22]
61+[%sum 22]
60− >=
62+>=
61```
63```
62
64
63We can see that app state is being saved, but when, where, and how?
65We can see that app state is being saved, but when, where, and how?
@@ -88,17 +90,7 @@ identity), and `eny` (256 bits of guaranteed-fresh entropy). For the full list
88of things in `++bowl`, search for `++ bowl` (note: two spaces) in
90of things in `++bowl`, search for `++ bowl` (note: two spaces) in
89`/arvo/zuse.hoon`.
91`/arvo/zuse.hoon`.
90
92
91−> This is, perhaps, the most common way to learn Hoon. The easiest way to learn
93+> This is, perhaps, the most common way to learn Hoon. The easiest way to learn about an identifier you see in code is to search in `/arvo/zuse.hoon` and `/arvo/hoon.hoon` for it.\\ Urbit's codebase is less than 30000 lines of code combined, including the hoon parser, the compiler, and the `/arvo` microkernel, so you can usually use the code and its comments as a reference doc. You can also read [zuse.hoon](https://github.com/urbit/arvo/blob/master/arvo/zuse.hoon) and [hoon.hoon](https://github.com/urbit/arvo/blob/master/arvo/hoon.hoon) in your browser.
92−> about an identifier you see in code is to search in `/arvo/zuse.hoon` and
93−> `/arvo/hoon.hoon` for it.\\ Urbit's codebase is less than 30000 lines of code
94−> combined,
95−> including the hoon parser, the compiler, and the `/arvo` microkernel, so you
96−> can
97−> usually use the code and its comments as a reference doc.
98−> You can also read
99−> [zuse.hoon](https://github.com/urbit/arvo/blob/master/arvo/zuse.hoon) and
100−> [hoon.hoon](https://github.com/urbit/arvo/blob/master/arvo/hoon.hoon) in your
101−> browser.
102
94
103The second thing we should clear up is this: Urbit needs no "serialize to disk"
95The second thing we should clear up is this: Urbit needs no "serialize to disk"
104step. Everything you produce in the app state is persistent across calls to the
96step. Everything you produce in the app state is persistent across calls to the
@@ -118,12 +110,14 @@ to set up and write to a database.
118Sample output:
110Sample output:
119
111
120```
112```
121− ~fintud-macrep:dojo> :last 7
113+~fintud-macrep:dojo> :last 7
122− [%last 0]
114+[%last 0]
123− >=
115+>=
116+
124− ~fintud-macrep:dojo> :last [1 2 3]
117+~fintud-macrep:dojo> :last [1 2 3]
125− [%last 7]
118+[%last 7]
126− >=
119+>=
120+
127− ~fintud-macrep:dojo> :last 'howdy'
121+~fintud-macrep:dojo> :last 'howdy'
128− [%last [1 2 3]]
122+[%last [1 2 3]]
129```
123```
docs/tutorials/gall/subscriptions.umd+155−148
@@ -18,124 +18,124 @@ Let's take a look at two apps, `:source` and `:sink`. First,
18`:source`:
18`:source`:
19
19
20```
20```
21− :: Sends subscription updates to sink.hoon
21+:: Sends subscription updates to sink.hoon
22− ::
22+::
23− :::: /===/app/source/hoon
23+:::: /===/app/source/hoon
24− ::
24+ ::
25− !:
25+!:
26− ::
26+::
27− |%
27+|%
28− +$ move [bone card]
28+ +$ move [bone card]
29− +$ card $% [%diff diff-contents]
29+ +$ card $% [%diff diff-contents]
30− ==
30+ ==
31− +$ diff-contents $% [%noun *]
31++$ diff-contents $% [%noun *]
32− ==
32+ ==
33− --
33+--
34− ::
34+::
35− |_ [bow=bowl:gall $~]
35+|_ [bow=bowl:gall $~]
36− ::
36+::
37− ++ poke-noun
37+++ poke-noun
38− |= non=*
38+ |= non=*
39− ^- [(list move) _+>.$]
39+ ^- [(list move) _+>.$]
40− :_ +>.$
40+ :_ +>.$
41− %+ turn (prey /example-path bow)
41+ %+ turn (prey /example-path bow)
42− |=({o=bone *} [o %diff %noun non])
42+ |=({o=bone *} [o %diff %noun non])
43− ::
43+::
44− ++ peer-example-path
44+++ peer-example-path
45− |= pax/path
45+ |= pax/path
46− ^- [(list move) _+>.$]
46+ ^- [(list move) _+>.$]
47− ~& source+peer-notify+'Someone subscribed to you!'
47+ ~& source+peer-notify+'Someone subscribed to you!'
48− ~& source+[ship+src.bow path+pax]
48+ ~& source+[ship+src.bow path+pax]
49− [~ +>.$]
50− ::
51− ++ coup
52− |= {wir=wire err=(unit tang)}
53− ^- [(list move) _+>.$]
54− ?~ err
55− ~& source+success+'Poke succeeded!'
56 [~ +>.$]
49 [~ +>.$]
50+::
51+++ coup
52+ |= {wir=wire err=(unit tang)}
53+ ^- [(list move) _+>.$]
54+ ?~ err
55+ ~& source+success+'Poke succeeded!'
56+ [~ +>.$]
57− ~& source+error+'Poke failed. Error:'
57+ ~& source+error+'Poke failed. Error:'
58− ~& source+error+err
58+ ~& source+error+err
59− [~ +>.$]
59+ [~ +>.$]
60− ::
60+::
61− ++ reap
61+++ reap
62− |= [wir=wire err=(unit tang)]
62+ |= [wir=wire err=(unit tang)]
63− ^- [(list move) _+>.$]
63+ ^- [(list move) _+>.$]
64− ?~ err
64+ ?~ err
65− ~& source+success+'Peer succeeded!'
65+ ~& source+success+'Peer succeeded!'
66+ [~ +>.$]
67+ ~& source+error+'Peer failed. Error:'
68+ ~& source+error+err
66 [~ +>.$]
69 [~ +>.$]
67− ~& source+error+'Peer failed. Error:'
68− ~& source+error+err
69− [~ +>.$]
70− ::
70+::
71− --
71+--
72```
72```
73
73
74And secondly, `:sink`:
74And secondly, `:sink`:
75
75
76```
76```
77− :: Sets up a simple subscription to source.hoon
77+:: Sets up a simple subscription to source.hoon
78− ::
78+::
79− :::: /===/app/sink/hoon
79+:::: /===/app/sink/hoon
80− ::
80+ ::
81− !:
81+!:
82− |%
82+|%
83− +$ move [bone card]
83++$ move [bone card]
84− +$ card $% [%peer wire dock path]
84++$ card $% [%peer wire dock path]
85− [%pull wire dock $~]
85+ [%pull wire dock $~]
86− ==
86+ ==
87− --
87+--
88− ::
88+::
89− |_ [bow=bowl:gall val=?]
89+|_ [bow=bowl:gall val=?]
90− ::
90+::
91− ++ poke-noun
91+++ poke-noun
92− |= non=*
92+ |= non=*
93− ^- [(list move) _+>.$]
93+ ^- [(list move) _+>.$]
94− ?: &(=(%on non) val)
94+ ?: &(=(%on non) val)
95− :_ +>.$(val |)
95+ :_ +>.$(val |)
96− :~ :* ost.bow
96+ :~ :* ost.bow
97 %peer
97 %peer
98 /subscribe
98 /subscribe
99 [our.bow %source]
99 [our.bow %source]
100 /example-path
100 /example-path
101 ==
101 ==
102− ==
102+ ==
103− ?: &(=(%off non) !val)
103+ ?: &(=(%off non) !val)
104− :_ +>.$(val &)
104+ :_ +>.$(val &)
105− ~[[ost.bow %pull /subscribe [our.bow %source] ~]]
105+ ~[[ost.bow %pull /subscribe [our.bow %source] ~]]
106− ~& ?: val
106+ ~& ?: val
107− sink+unsubscribed+'You are now unsubscribed!'
107+ sink+unsubscribed+'You are now unsubscribed!'
108− sink+subscribed+'You are now subscribed!'
108+ sink+subscribed+'You are now subscribed!'
109− [~ +>.$]
110− ::
111− ++ diff-noun
112− |= [wir=wire non=*]
113− ^- [(list move) _+>.$]
114− ~& sink+received-data+'You got something!'
115− ~& sink+data+non
116− [~ +>.$]
117− ::
118− ++ coup
119− |= [wir=wire err=(unit tang)]
120− ^- [(list move) _+>.$]
121− ?~ err
122− ~& sink+success+'Poke succeeded!'
123 [~ +>.$]
109 [~ +>.$]
124− ~& sink+error+'Poke failed. Error:'
125− ~& sink+error+err
126− [~ +>.$]
127− ::
110+::
128− ++ reap
111+++ diff-noun
129− |= [wir=wire err=(unit tang)]
112+ |= [wir=wire non=*]
130− ^- [(list move) _+>.$]
113+ ^- [(list move) _+>.$]
131− ?~ err
114+ ~& sink+received-data+'You got something!'
132− ~& sink+success+'Peer succeeded!'
115+ ~& sink+data+non
133 [~ +>.$]
116 [~ +>.$]
117+::
118+++ coup
119+ |= [wir=wire err=(unit tang)]
120+ ^- [(list move) _+>.$]
121+ ?~ err
122+ ~& sink+success+'Poke succeeded!'
123+ [~ +>.$]
134− ~& sink+error+'Peer failed. Error:'
124+ ~& sink+error+'Poke failed. Error:'
135− ~& sink+error+err
125+ ~& sink+error+err
136− [~ +>.$]
126+ [~ +>.$]
137− ::
127+::
128+++ reap
129+ |= [wir=wire err=(unit tang)]
130+ ^- [(list move) _+>.$]
131+ ?~ err
132+ ~& sink+success+'Peer succeeded!'
133+ [~ +>.$]
134+ ~& sink+error+'Peer failed. Error:'
135+ ~& sink+error+err
136+ [~ +>.$]
137+::
138− --
138+--
139```
139```
140
140
141Two notes:
141Two notes:
@@ -147,32 +147,39 @@ Two notes:
147Here's some sample output of the two working together:
147Here's some sample output of the two working together:
148
148
149```
149```
150− ~fintud-macrep:dojo> |start %source
150+~fintud-macrep:dojo> |start %source
151− >=
151+>=
152+
152− ~fintud-macrep:dojo> |start %sink
153+~fintud-macrep:dojo> |start %sink
153− >=
154+>=
155+
154− ~fintud-macrep:dojo> :sink %on
156+~fintud-macrep:dojo> :sink %on
155− [%source %peer-notify 'Someone subscribed to you!']
157+[%source %peer-notify 'Someone subscribed to you!']
156− [%source [%ship ~fintud-macrep] %path /]
158+[%source [%ship ~fintud-macrep] %path /]
157− [%sink %success 'Peer succeeded!']
159+[%sink %success 'Peer succeeded!']
158− >=
160+>=
161+
159− ~fintud-macrep:dojo> :source 5
162+~fintud-macrep:dojo> :source 5
160− [%sink %received-data 'You got something!']
163+[%sink %received-data 'You got something!']
161− [%sink %data 5]
164+[%sink %data 5]
162− >=
165+>=
166+
163− ~fintud-macrep:dojo> :sink %off
167+~fintud-macrep:dojo> :sink %off
164− >=
168+>=
169+
165− ~fintud-macrep:dojo> :source 6
170+~fintud-macrep:dojo> :source 6
166− >=
171+>=
172+
167− ~fintud-macrep:dojo> :sink %on
173+~fintud-macrep:dojo> :sink %on
168− [%source %peer-notify 'Someone subscribed to you!']
174+[%source %peer-notify 'Someone subscribed to you!']
169− [%source [%ship ~fintud-macrep] %path /]
175+[%source [%ship ~fintud-macrep] %path /]
170− [%sink %success 'Peer succeeded!']
176+[%sink %success 'Peer succeeded!']
171− >=
177+>=
178+
172− ~fintud-macrep:dojo> :source 7
179+~fintud-macrep:dojo> :source 7
173− [%sink %received-data 'You got something!']
180+[%sink %received-data 'You got something!']
174− [%sink %data 7]
181+[%sink %data 7]
175− >=
182+>=
176```
183```
177
184
178### :source
185### :source
@@ -190,8 +197,8 @@ Our definition of `move` is fairly specific, since we're only going to
190sending one kind of move. The `%diff` move is a subscription update, and
197sending one kind of move. The `%diff` move is a subscription update, and
191its content is marked data which gall routes to our subscribers.
198its content is marked data which gall routes to our subscribers.
192
199
193−This is a slightly different kind of move than [we've dealt with so
200+This is a slightly different kind of move than we've dealt with so
194−far](/arvo/network). It's producing a result rather than calling other
201+far. It's producing a result rather than calling other
195code (i.e. it's a return rather than a function call), so if you recall
202code (i.e. it's a return rather than a function call), so if you recall
196the discussion of ducts, a layer gets popped off the duct rather than
203the discussion of ducts, a layer gets popped off the duct rather than
197added to it. This is why no wire is needed for the move -- we won't
204added to it. This is why no wire is needed for the move -- we won't
@@ -227,7 +234,7 @@ that begins with the given path. "Prey" is short for "prefix".
227Now we have the list of relevant subscribers. This a list of triples,
234Now we have the list of relevant subscribers. This a list of triples,
228`{bone @p path}`, where the only thing we really need is the bone, because we
235`{bone @p path}`, where the only thing we really need is the bone, because we
229don't need to know their urbit or what exact path they subscribed on. Thus, our
236don't need to know their urbit or what exact path they subscribed on. Thus, our
230−transformer function takes `{o/bone *}` and produces `[o %diff %noun non]`,
237+transformer function takes `[o=bone *]` and produces `[o %diff %noun non]`,
231which is a move that provides bone `o` with this subscription update:
238which is a move that provides bone `o` with this subscription update:
232`[%noun non]`". This is fairly dense code, but what it's doing is
239`[%noun non]`". This is fairly dense code, but what it's doing is
233straightforward!
240straightforward!
@@ -251,7 +258,7 @@ your bone and wire are the same as when you subscribed, then the cancellation
251will happen correctly.
258will happen correctly.
252
259
253The only state we need for `:sink` is a boolean to indicate whether
260The only state we need for `:sink` is a boolean to indicate whether
254−we're already subscribed to `:source`. We use `val/?`, where `?`
261+we're already subscribed to `:source`. We use `val=?`, where `?`
255is the sign of type boolean (similar to `*`, `@`), which defaults to true (that
262is the sign of type boolean (similar to `*`, `@`), which defaults to true (that
256is, `0`).
263is, `0`).
257
264
@@ -260,13 +267,13 @@ available (`val` is true). If so, we produce the move to subscribe to
260`:source`:
267`:source`:
261
268
262```
269```
263− :~ :* ost.bow
270+:~ :* ost.bow
264− %peer
271+ %peer
265− /subscribe
272+ /subscribe
266− [our.bow %source]
273+ [our.bow %source]
267− /example-path
274+ /example-path
268− ==
269 ==
275 ==
276+==
270```
277```
271
278
272Also, in the preceding lines, we set `val` to false (`|`) with `+>.$(val |)`.
279Also, in the preceding lines, we set `val` to false (`|`) with `+>.$(val |)`.
@@ -281,8 +288,8 @@ is false), then we unsubscribe from `:source` and set `val` back to true (`&`),
281again using our handy inverted cell constructor mold `:_`:
288again using our handy inverted cell constructor mold `:_`:
282
289
283```
290```
284− :_ +>.$(val &)
291+:_ +>.$(val &)
285− ~[[ost.bow %pull /subscribe [our.bow %source] ~]]
292+~[[ost.bow %pull /subscribe [our.bow %source] ~]]
286```
293```
287
294
288It's important to send over the same bone and wire (`/subscribe`) as the
295It's important to send over the same bone and wire (`/subscribe`) as the
@@ -293,10 +300,10 @@ state, based on whether `val` is true or false, and return a cell containing
293a null list of moves and our unchanged app state:
300a null list of moves and our unchanged app state:
294
301
295```
302```
296− ~& ?: val
303+~& ?: val
297− sink+unsubscribed+'You are now unsubscribed!'
304+ sink+unsubscribed+'You are now unsubscribed!'
298− sink+subscribed+'You are now subscribed!'
305+ sink+subscribed+'You are now subscribed!'
299− [~ +>.$]
306+[~ +>.$]
300```
307```
301
308
302`++diff-noun` is called when we get a `%diff` update along a subscription with a
309`++diff-noun` is called when we get a `%diff` update along a subscription with a
@@ -305,8 +312,8 @@ the `%peer` subscription request along and the data we got back. In our case we
305just print out the data:
312just print out the data:
306
313
307```
314```
308− ~& sink+received-data+'You got something!'
315+~& sink+received-data+'You got something!'
309− ~& sink+data+non
316+~& sink+data+non
310```
317```
311
318
312`++reap` is called when we receive an acknowledgment as to whether the
319`++reap` is called when we receive an acknowledgment as to whether the
docs/tutorials/sail.umd+9−9
@@ -312,8 +312,8 @@ is done by wrapping the code to be inserted in `{}`. In your Dojo prompt, try
312the command below (without the `>`):
312the command below (without the `>`):
313
313
314```
314```
315− > "I am a l{(mul 3 11)}t Urbit user."
315+> "I am a l{(mul 3 11)}t Urbit user."
316− ! exit
316+! exit
317```
317```
318
318
319Oh no! That command produced a nest-fail error, which indicates that there was
319Oh no! That command produced a nest-fail error, which indicates that there was
@@ -325,8 +325,8 @@ Trying the `mul` function on its own will help answer this question. Try the
325following command in your Dojo:
325following command in your Dojo:
326
326
327```
327```
328− > (mul 3 11)
328+> (mul 3 11)
329− 33
329+33
330```
330```
331
331
332This should work, producing `33`, an atom. That’s our problem. The
332This should work, producing `33`, an atom. That’s our problem. The
@@ -334,16 +334,16 @@ interpolation expression expects a tape, but our first command tried to
334interpolate with something that results in an atom. Try this now:
334interpolate with something that results in an atom. Try this now:
335
335
336```
336```
337− > <(mul 3 11)>
337+> <(mul 3 11)>
338− "33"
338+"33"
339```
339```
340
340
341We get a similar result, but we know that it’s a tape because it’s wrapped in
341We get a similar result, but we know that it’s a tape because it’s wrapped in
342`""`. Bingo! With this knowledge, let’s perform a successful interpolation:
342`""`. Bingo! With this knowledge, let’s perform a successful interpolation:
343
343
344```
344```
345− > "I am a l{<(mul 3 11)>}t Urbit user."
345+> "I am a l{<(mul 3 11)>}t Urbit user."
346− "I am a l33t Urbit user."
346+"I am a l33t Urbit user."
347```
347```
348
348
349Great!
349Great!
@@ -369,7 +369,7 @@ To see this difference, first save the code below to a file at
369Then enter the following command in the Dojo:
369Then enter the following command in the Dojo:
370
370
371```
371```
372− > .
372+> .
373```
373```
374
374
375You'll notice that the Sail subject is like a stripped-down version of the Dojo
375You'll notice that the Sail subject is like a stripped-down version of the Dojo