@@ -31,10 +31,10 @@ Another generator is `+hood/merge`. Try running `+hood/merge` with the
31normal arguments for `|merge`:
31normal arguments for `|merge`:
34− ~fintud-macrep:dojo> +hood/merge %home our %they
34+~fintud-macrep:dojo> +hood/merge %home our %they
35− [syd=%home her=~fintud-macrep sud=%they gem=%auto]
35+[syd=%home her=~fintud-macrep sud=%they gem=%auto]
36− ~fintud-macrep:dojo> +hood/merge %home our %they, =gem %this
36+~fintud-macrep:dojo> +hood/merge %home our %they, =gem %this
37− [syd=%home her=~fintud-macrep sud=%they gem=%auto]
37+[syd=%home her=~fintud-macrep sud=%they gem=%auto]
40This didn't run any merge, it just constructed the command that, if sent
40This didn't run any merge, it just constructed the command that, if sent
@@ -66,66 +66,63 @@ it lets the user optionally specify the message as well.
66We'll need a new mark for our arguments. Let's call it
66We'll need a new mark for our arguments. Let's call it
67`examples-ping-message`.
67`examples-ping-message`.
69−> For app-specific marks, it's good style to prefix the name of the mark
69+> For app-specific marks, it's good style to prefix the name of the mark with the name of the app. Since many apps have several such marks, subdirectories in `/mar` are rendered as `-`, so that `ping-message` is written in (/mar/examples/ping/message.hoon).
70−> with the name of the app. Since many apps have several such marks,
71−> subdirectories in `/mar` are rendered as `-`, so that `ping-message`
72−> is written in (/mar/examples/ping/message.hoon).
76− :::: /hoon/message/ping/examples/app
73+:::: /hoon/message/ping/examples/app
79− |_ [to=@p message=@t]
76+|_ [to=@p message=@t]
82− ++ noun [@p @t]
79+ ++ noun [@p @t]
87The app can easily be modified to use this (`/app/examples/ping.hoon`):
84The app can easily be modified to use this (`/app/examples/ping.hoon`):
90− :: Allows one ship to ping another with a string of text
87+:: Allows one ship to ping another with a string of text
92− :::: /hoon/ping/examples/app
89+:::: /hoon/ping/examples/app
96− ++ move [bone term wire *]
93+ ++ move [bone term wire *]
99− |_ [bowl:gall state=$~]
96+|_ [bowl:gall state=$~]
101− ++ poke-examples-ping-message
98+++ poke-examples-ping-message
102− |= [to=@p message/@t}
99+ |= [to=@p message/@t}
103− ~& 'sent'
100+ ~& 'sent'
104− ^- [(list move) _+>.$]
101+ ^- [(list move) _+>.$]
105− :- ^- (list move)
102+ :- ^- (list move)
106− :~ `move`[ost %poke /sending [to dap] %atom message]
103+ :~ `move`[ost %poke /sending [to dap] %atom message]
110− ++ poke-atom
107+++ poke-atom
111− |= arg=@
108+ |= arg=@
112− ~& 'received'
109+ ~& 'received'
113− ^- [(list move) _+>.$]
110+ ^- [(list move) _+>.$]
115− ~& [%receiving (@t arg)]
112+ ~& [%receiving (@t arg)]
116− [~ +>.$]
113+ [~ +>.$]
118− ++ coup |=(* `+>)
115+++ coup |=(* `+>)
122Now we can run this with:
119Now we can run this with:
125− ~fintud-macrep:dojo> |start %examples-ping
122+~fintud-macrep:dojo> |start %examples-ping
127− ~fintud-macrep:dojo> :examples-ping &examples-ping-message [~sampel-sipnym 'heyya']
124+~fintud-macrep:dojo> :examples-ping &examples-ping-message [~sampel-sipnym 'heyya']
131And on `~sampel-sipnym`, assuming it's running `:examples-ping` as well,
128And on `~sampel-sipnym`, assuming it's running `:examples-ping` as well,
@@ -137,9 +134,9 @@ mandatory, and optional arguments are hard. Let's make a generator,
137`:examples-ping`, let's put it in `/gen/examples/ping/send.hoon`:
134`:examples-ping`, let's put it in `/gen/examples/ping/send.hoon`:
141− |= [^ [to=@p message=?($~ [text=@t $~])] $~]
138+|= [^ [to=@p message=?($~ [text=@t $~])] $~]
142− [%examples-ping-message to ?~(message 'howdy' text.message)]
139+[%examples-ping-message to ?~(message 'howdy' text.message)]
145A couple of new things here. Firstly, `message=?($~ [text=@t $~])`
142A couple of new things here. Firstly, `message=?($~ [text=@t $~])`
@@ -154,10 +151,10 @@ anything that's in either `a` or `b`. Thus, in our case,
154This is run as follows:
151This is run as follows:
157− ~fintud-macrep:dojo> :examples-ping|send ~sampel-sipnym
154+~fintud-macrep:dojo> :examples-ping|send ~sampel-sipnym
159− ~fintud-macrep:dojo> :examples-ping|send ~sampel-sipnym 'how do you do'
156+~fintud-macrep:dojo> :examples-ping|send ~sampel-sipnym 'how do you do'
163Which causes `~sampel-sipnym` to print `[%receiving 'howdy']` and
160Which causes `~sampel-sipnym` to print `[%receiving 'howdy']` and