on master help sign in
Replaced incorrect example code. It was showing hoon code for an unrelated application, but now shows the related mark's code.
9440f3cFang
docs/arvo/generators.md+8−65
@@ -72,81 +72,26 @@ We'll need a new mark for our arguments. Let's call it
72> (/mar/examples/ping/message.hoon).
72> (/mar/examples/ping/message.hoon).
73
73
74```
74```
75−:: Up-ness monitor. Accepts atom url, 'on', or 'off'
76::
75::
77−:::: /hoon/up/examples/app
76+:::: /hoon/message/ping/examples/app
78 ::
77 ::
79/? 314
78/? 314
79+|_ {to/@p message/@t}
80+++ grab
80−|%
81+ |%
81−++ move {bone card}
82+ ++ noun {@p @t}
82−++ card
83− $% {$hiss wire $~ $httr {$purl p/purl}}
84− {$wait wire @da}
85− ==
86−++ action
87− $% {$on $~} :: enable polling('on')
88− {$off $~} :: disable polling('off)
89− {$target p/cord} :: set poll target('http://...')
90− ==
91−--
83+ --
92−|_ {hid/bowl on/_| in-progress/_| target/@t}
93−++ poke-atom
94− |= url-or-command/@t ^- (quip move +>)
95− =+ ^- act/action
96− ?: ?=($on url-or-command) [%on ~]
97− ?: ?=($off url-or-command) [%off ~]
98− [%target url-or-command]
99− ?- -.act
100− $target [~ +>.$(target p.act)]
101− $off [~ +>.$(on |)]
102− $on
103− :- ?: |(on in-progress) ~
104− [ost.hid %hiss /request ~ %httr %purl (need (epur target))]~
105− +>.$(on &, in-progress &)
106− ==
107−::
108−
109−:: ~& 'i get here'
110−:: ^- {(list move) _+>.$}
111−:: ?: =('off' url)
112−:: [~ +>.$(on |)]
113−:: ?: =('on' url)
114−:: :_ +>.$(on &, in-progress &)
115−:: ?: |(on in-progress)
116−:: ~
117−:: [ost.hid %them /request ~ (need (epur target)) %get ~ ~]~
118−:: [~ +>.$(target url)]
119−++ sigh-httr
120− |= {wir/wire code/@ud headers/mess body/(unit octs)}
121− ~& 'arrive here'
122− ^- {(list move) _+>.$}
123− ?: &((gte code 200) (lth code 300))
124− ~& [%all-is-well code]
125− :_ +>.$
126− [ost.hid %wait /timer (add ~s10 now.hid)]~
127− ~& [%we-have-a-problem code]
128− ~& [%headers headers]
129− ~& [%body body]
130− :_ +>.$
131− [ost.hid %wait /timer (add ~s10 now.hid)]~
132−++ wake-timer
133− |= {wir/wire $~} ^- (quip move +>)
134− ?: on
135− :_ +>.$
136− [ost.hid %hiss /request ~ %httr %purl (need (epur target))]~
137− [~ +>.$(in-progress |)]
138−::
139−++ prep ~& target _`. ::
140--
84--
141```
85```
142
86
143The app can easily be modified to use this (`/app/examples/ping.hoon`):
87The app can easily be modified to use this (`/app/examples/ping.hoon`):
144
88
145```
89```
90+:: Allows one ship to ping another with a string of text
146::
91::
147:::: /hoon/ping/examples/app
92:::: /hoon/ping/examples/app
148 ::
93 ::
149−/? 151
94+/? 314
150|%
95|%
151 ++ move {bone term wire *}
96 ++ move {bone term wire *}
152--
97--
@@ -172,8 +117,6 @@ The app can easily be modified to use this (`/app/examples/ping.hoon`):
172::
117::
173++ coup |=(* `+>)
118++ coup |=(* `+>)
174--
119--
175−
176−
177```
120```
178
121
179Now we can run this with:
122Now we can run this with: