on master help sign in
updates based on @ohAitch commentary
b0892c5David Kerschner
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.
74 ==
74 ==
75--
75--
76|_ [bol=bowl:gall ~]
76|_ [bol=bowl:gall ~]
77++* this .
77++ bound
78++ bound
78 |= [wir=wire success=? binding=binding:eyre]
79 |= [wir=wire success=? binding=binding:eyre]
79− ^- (quip move _+>.$)
80+ ^- (quip move _this)
80− [~ +>.$]
81+ [~ this]
81++ prep
82++ prep
82 |= old=(unit ~)
83 |= old=(unit ~)
83 ~& 'it built'
84 ~& 'it built'
84− ^- (quip move _+>.$)
85+ ^- (quip move _this)
85 =/ launcha
86 =/ launcha
86 [%launch-action [%testing /testingtile '/~testing/js/tile.js']]
87 [%launch-action [%testing /testingtile '/~testing/js/tile.js']]
87− :_ +>.$
88+ :_ this
88 :~
89 :~
89 [ost.bol %connect / [~ /'~testing'] %testing]
90 [ost.bol %connect / [~ /'~testing'] %testing]
90 [ost.bol %poke /testing [our.bol %launch] launcha]
91 [ost.bol %poke /testing [our.bol %launch] launcha]
91 ==
92 ==
92++ peer-testingtile
93++ peer-testingtile
93 |= pax=path
94 |= pax=path
94− ^- (quip move _+>.$)
95+ ^- (quip move _this)
96+ =/ jon=json
95− =/ jon=json %- pairs:enjs:format :~
97+ %- pairs:enjs:format :~
96 [%status `json`s+'First starting']
98 [%status `json`s+'First starting']
97 ==
99 ==
98− [[ost.bol %diff %json jon]~ +>.$]
100+ [[ost.bol %diff %json jon]~ this]
99++ send-tile-diff
101++ send-tile-diff
100 |= jon=json
102 |= jon=json
101 ^- (list move)
103 ^- (list move)
@@ -110,16 +112,16 @@ In your pier, replace the code in `/app/testing.hoon` with the Hoon code below.
110 ==
112 ==
111++ poke-json
113++ poke-json
112 |= jon=json
114 |= jon=json
113− ^- (quip move _+>.$)
115+ ^- (quip move _this)
114 ~& 'poke-json in testing called'
116 ~& 'poke-json in testing called'
115 ~& jon
117 ~& jon
116− =/ json-map ((om:dejs format same) jon)
118+ =/ json-map ((om:dejs:format same) jon)
117 =/ ship-to-hi (so:dejs:format (~(got by json-map) %ship))
119 =/ ship-to-hi (so:dejs:format (~(got by json-map) %ship))
118 ~& ship-to-hi
120 ~& ship-to-hi
119 =/ sthu (need (slaw %p ship-to-hi))
121 =/ sthu (need (slaw %p ship-to-hi))
120− :_ +>.$
122+ :_ this
121 %+ weld
123 %+ weld
122− (send-status-diff "looking")
124+ (send-status-diff "looking")
123 ^- (list move)
125 ^- (list move)
124 :~
126 :~
125 :- ost.bol
127 :- ost.bol
@@ -131,14 +133,14 @@ In your pier, replace the code in `/app/testing.hoon` with the Hoon code below.
131++ coup-helm-hi
133++ coup-helm-hi
132 |= [pax=path cop=(unit tang)]
134 |= [pax=path cop=(unit tang)]
133 ~& ["Coup recieved" pax]
135 ~& ["Coup recieved" pax]
134− :_ +>.$
136+ :_ this
135 ?~ cop
137 ?~ cop
136 (send-status-diff "successfully found {<pax>}")
138 (send-status-diff "successfully found {<pax>}")
137 (send-status-diff "failure")
139 (send-status-diff "failure")
138++ poke-handle-http-request
140++ poke-handle-http-request
139 %- (require-authorization:app ost.bol move .)
141 %- (require-authorization:app ost.bol move .)
140 |= =inbound-request:eyre
142 |= =inbound-request:eyre
141− ^- (quip move _+>.$)
143+ ^- (quip move _this)
142 =/ request-line (parse-request-line url.request.inbound-request)
144 =/ request-line (parse-request-line url.request.inbound-request)
143 =/ back-path (flop site.request-line)
145 =/ back-path (flop site.request-line)
144 =/ name=@t
146 =/ name=@t
@@ -147,10 +149,10 @@ In your pier, replace the code in `/app/testing.hoon` with the Hoon code below.
147 ''
149 ''
148 i.back-path
150 i.back-path
149 ?~ back-path
151 ?~ back-path
150− [[ost.bol %http-response not-found:app]~ +>.$]
152+ [[ost.bol %http-response not-found:app]~ this]
151 ?: =(name 'tile')
153 ?: =(name 'tile')
152− [[ost.bol %http-response (js-response:app tile-js)]~ +>.$]
154+ [[ost.bol %http-response (js-response:app tile-js)]~ this]
153− [[ost.bol %http-response not-found:app]~ +>.$]
155+ [[ost.bol %http-response not-found:app]~ this]
154::
156::
155--
157--
156```
158```
@@ -218,14 +220,14 @@ Now that we've glanced at the default components of the program, lets take a clo
218``` hoon
220``` hoon
219++ poke-json
221++ poke-json
220 |= jon=json
222 |= jon=json
221− ^- (quip move _+>.$)
223+ ^- (quip move _this)
222 ~& 'poke-json in testing called'
224 ~& 'poke-json in testing called'
223 ~& jon
225 ~& jon
224− =/ json-map ((om:dejs format same) jon)
226+ =/ json-map ((om:dejs:format same) jon)
225 =/ ship-to-hi (so:dejs:format (~(got by json-map) %ship))
227 =/ ship-to-hi (so:dejs:format (~(got by json-map) %ship))
226 ~& ship-to-hi
228 ~& ship-to-hi
227 =/ sthu (need (slaw %p ship-to-hi))
229 =/ sthu (need (slaw %p ship-to-hi))
228− :_ +>.$
230+ :_ this
229 %+ weld
231 %+ weld
230 (send-status-diff "looking")
232 (send-status-diff "looking")
231 ^- (list move)
233 ^- (list move)
@@ -246,7 +248,7 @@ There are several uses of the `~&` rune. These are simply debugging printfs that
246
248
247`++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.
249`++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.
248
250
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.
250
252
251``` hoon
253``` hoon
252++ send-status-diff
254++ send-status-diff
@@ -267,7 +269,7 @@ When we get a response from `%helm` to our `poke`, we'll receive a `coup`, which
267++ coup-helm-hi
269++ coup-helm-hi
268 |= [pax=path cop=(unit tang)]
270 |= [pax=path cop=(unit tang)]
269 ~& ["Coup recieved" pax]
271 ~& ["Coup recieved" pax]
270− :_ +>.$
272+ :_ this
271 ?~ cop
273 ?~ cop
272 (send-status-diff "successfully found {<pax>}")
274 (send-status-diff "successfully found {<pax>}")
273 (send-status-diff "failure")
275 (send-status-diff "failure")