on master help sign in
updates based on @ohAitch commentary
commitb0892c527f9f560825e9283c3b158b79cb7c3a9b authorDavid Kerschner <dkerschner@hcoop.net> dateFri 25 Oct 2019, 11:51 (7 years ago) parent6d20c9e
1 file changed+23−21
tutorials/hoon/landscape-tile.md+23−21
tutorials/hoon/landscape-tile.md+23−21
@@ -74,28 +74,30 @@ In your pier, replace the code in `/app/testing.hoon` with the Hoon code below.
7474 ==
7575--
7676|_ [bol=bowl:gall ~]
77++* this .
7778++ bound
7879 |= [wir=wire success=? binding=binding:eyre]
79− ^- (quip move _+>.$)
80− [~ +>.$]
80+ ^- (quip move _this)
81+ [~ this]
8182++ prep
8283 |= old=(unit ~)
8384 ~& 'it built'
84− ^- (quip move _+>.$)
85+ ^- (quip move _this)
8586 =/ launcha
8687 [%launch-action [%testing /testingtile '/~testing/js/tile.js']]
87− :_ +>.$
88+ :_ this
8889 :~
8990 [ost.bol %connect / [~ /'~testing'] %testing]
9091 [ost.bol %poke /testing [our.bol %launch] launcha]
9192 ==
9293++ peer-testingtile
9394 |= pax=path
94− ^- (quip move _+>.$)
95− =/ jon=json %- pairs:enjs:format :~
95+ ^- (quip move _this)
96+ =/ jon=json
97+ %- pairs:enjs:format :~
9698 [%status `json`s+'First starting']
9799 ==
98− [[ost.bol %diff %json jon]~ +>.$]
100+ [[ost.bol %diff %json jon]~ this]
99101++ send-tile-diff
100102 |= jon=json
101103 ^- (list move)
@@ -110,16 +112,16 @@ In your pier, replace the code in `/app/testing.hoon` with the Hoon code below.
110112 ==
111113++ poke-json
112114 |= jon=json
113− ^- (quip move _+>.$)
115+ ^- (quip move _this)
114116 ~& 'poke-json in testing called'
115117 ~& jon
116− =/ json-map ((om:dejs format same) jon)
118+ =/ json-map ((om:dejs:format same) jon)
117119 =/ ship-to-hi (so:dejs:format (~(got by json-map) %ship))
118120 ~& ship-to-hi
119121 =/ sthu (need (slaw %p ship-to-hi))
120− :_ +>.$
122+ :_ this
121123 %+ weld
122− (send-status-diff "looking")
124+ (send-status-diff "looking")
123125 ^- (list move)
124126 :~
125127 :- ost.bol
@@ -131,14 +133,14 @@ In your pier, replace the code in `/app/testing.hoon` with the Hoon code below.
131133++ coup-helm-hi
132134 |= [pax=path cop=(unit tang)]
133135 ~& ["Coup recieved" pax]
134− :_ +>.$
136+ :_ this
135137 ?~ cop
136138 (send-status-diff "successfully found {<pax>}")
137139 (send-status-diff "failure")
138140++ poke-handle-http-request
139141 %- (require-authorization:app ost.bol move .)
140142 |= =inbound-request:eyre
141− ^- (quip move _+>.$)
143+ ^- (quip move _this)
142144 =/ request-line (parse-request-line url.request.inbound-request)
143145 =/ back-path (flop site.request-line)
144146 =/ name=@t
@@ -147,10 +149,10 @@ In your pier, replace the code in `/app/testing.hoon` with the Hoon code below.
147149 ''
148150 i.back-path
149151 ?~ back-path
150− [[ost.bol %http-response not-found:app]~ +>.$]
152+ [[ost.bol %http-response not-found:app]~ this]
151153 ?: =(name 'tile')
152− [[ost.bol %http-response (js-response:app tile-js)]~ +>.$]
153− [[ost.bol %http-response not-found:app]~ +>.$]
154+ [[ost.bol %http-response (js-response:app tile-js)]~ this]
155+ [[ost.bol %http-response not-found:app]~ this]
154156::
155157--
156158```
@@ -218,14 +220,14 @@ Now that we've glanced at the default components of the program, lets take a clo
218220``` hoon
219221++ poke-json
220222 |= jon=json
221− ^- (quip move _+>.$)
223+ ^- (quip move _this)
222224 ~& 'poke-json in testing called'
223225 ~& jon
224− =/ json-map ((om:dejs format same) jon)
226+ =/ json-map ((om:dejs:format same) jon)
225227 =/ ship-to-hi (so:dejs:format (~(got by json-map) %ship))
226228 ~& ship-to-hi
227229 =/ sthu (need (slaw %p ship-to-hi))
228− :_ +>.$
230+ :_ this
229231 %+ weld
230232 (send-status-diff "looking")
231233 ^- (list move)
@@ -246,7 +248,7 @@ There are several uses of the `~&` rune. These are simply debugging printfs that
246248
247249`++so:dejs:format` formats some piece of data out of the `json` map, in this case the value of `%ship`. `sthu` is transformed by [`slaw`](https://urbit.org/docs/reference/library/4m/#slaw) into an actual `@p` to verify that we didn't get sent nonsense. If we did, `need` will cause the gate to crash.
248250
249−Finally, we produce the list of `move`s and the new state that is the data. This starts with the `:_` rune, which is the inverted form of `:-`, the [cons](https://en.wikipedia.org/wiki/Cons) rune. The state of our application will not actually change, so we can just use `+>.$` the existing core.
251+Finally, we produce the list of `move`s and the new state that is the data. This starts with the `:_` rune, which is the inverted form of `:-`, the [cons](https://en.wikipedia.org/wiki/Cons) rune. The state of our application will not actually change, so we can just use `this` the existing core.
250252
251253``` hoon
252254++ send-status-diff
@@ -267,7 +269,7 @@ When we get a response from `%helm` to our `poke`, we'll receive a `coup`, which
267269++ coup-helm-hi
268270 |= [pax=path cop=(unit tang)]
269271 ~& ["Coup recieved" pax]
270− :_ +>.$
272+ :_ this
271273 ?~ cop
272274 (send-status-diff "successfully found {<pax>}")
273275 (send-status-diff "failure")