on master help sign in
gall-guide: fix overly wide code
f51d617tinnus-napbus
content/docs/userspace/gall-guide/7-sur-and-marks.md+36−9
@@ -88,34 +88,61 @@ manner:
88```hoon
88```hoon
89++ on-poke
89++ on-poke
90 |= [=mark =vase]
90 |= [=mark =vase]
91− |^ ^- (quip card _this)
91+ ^- (quip card _this)
92+ |^
93+ ?> =(src.bowl our.bowl)
92 ?+ mark (on-poke:def mark vase)
94 ?+ mark (on-poke:def mark vase)
93− %noun
95+ %todo-action
94 =^ cards state
96 =^ cards state
95 (handle-poke !<(action:todo vase))
97 (handle-poke !<(action:todo vase))
96 [cards this]
98 [cards this]
99+ ==
100+ ::
97 ++ handle-poke
101 ++ handle-poke
98 |= =action:todo
102 |= =action:todo
99 ^- (quip card _state)
103 ^- (quip card _state)
100 ?- -.action
104 ?- -.action
101 %add
105 %add
102 :_ state(tasks (~(put by tasks) now.bowl [name.action %.n]))
106 :_ state(tasks (~(put by tasks) now.bowl [name.action %.n]))
107+ :~ :* %give %fact ~[/updates] %todo-update
103− :~ [%give %fact ~[/updates] %noun !>(`update:todo`[%add now.bowl name.action])]
108+ !>(`update:todo`[%add now.bowl name.action])
109+ ==
104 ==
110 ==
105 ::
111 ::
106− %del
112+ %del
107 :_ state(tasks (~(del by tasks) id.action))
113 :_ state(tasks (~(del by tasks) id.action))
114+ :~ :* %give %fact ~[/updates] %todo-update
108− :~ [%give %fact ~[/updates] %noun !>(`update:todo`action)]
115+ !>(`update:todo`action)
116+ ==
109 ==
117 ==
110 ::
118 ::
111 %toggle
119 %toggle
120+ :_ %= state
121+ tasks %+ ~(jab by tasks)
122+ id.action
112− :_ state(tasks (~(jab by tasks) id.action |=(=task task(done !done.task))))
123+ |=(=task:todo task(done !done.task))
124+ ==
125+ :~ :* %give %fact ~[/updates] %todo-update
113− :~ [%give %fact ~[/updates] %noun !>(`update:todo`action)]
126+ !>(`update:todo`action)
127+ ==
114 ==
128 ==
115 ::
129 ::
116 %rename
130 %rename
131+ :_ %= state
132+ tasks %+ ~(jab by tasks)
133+ id.action
117− :_ state(tasks (~(jab by tasks) id.action |=(=task task(name name.action))))
134+ |=(=task:todo task(name name.action))
135+ ==
136+ :~ :* %give %fact ~[/updates] %todo-update
118− :~ [%give %fact ~[/updates] %noun !>(`update:todo`action)]
137+ !>(`update:todo`action)
138+ ==
139+ ==
140+ %allow
141+ `state(friends (~(put in friends) who.action))
142+ ::
143+ %kick
144+ :_ state(friends (~(del in friends) who.action))
145+ :~ [%give %kick ~[/updates] `who.action]
119 ==
146 ==
120 ==
147 ==
121 --
148 --
content/docs/userspace/gall-guide/8-subscriptions.md+23−8
@@ -455,24 +455,39 @@ This is a very simple mark file for the `update` type.
455 ?- -.action
455 ?- -.action
456 %add
456 %add
457 :_ state(tasks (~(put by tasks) now.bowl [name.action %.n]))
457 :_ state(tasks (~(put by tasks) now.bowl [name.action %.n]))
458+ :~ :* %give %fact ~[/updates] %todo-update
458− :~ [%give %fact ~[/updates] %todo-update !>(`update:todo`[%add now.bowl name.action])]
459+ !>(`update:todo`[%add now.bowl name.action])
460+ ==
459 ==
461 ==
460 ::
462 ::
461− %del
463+ %del
462 :_ state(tasks (~(del by tasks) id.action))
464 :_ state(tasks (~(del by tasks) id.action))
463− :~ [%give %fact ~[/updates] %todo-update !>(`update:todo`action)]
465+ :~ :* %give %fact ~[/updates] %todo-update
466+ !>(`update:todo`action)
467+ ==
464 ==
468 ==
465 ::
469 ::
466 %toggle
470 %toggle
471+ :_ %= state
472+ tasks %+ ~(jab by tasks)
473+ id.action
467− :_ state(tasks (~(jab by tasks) id.action |=(=task:todo task(done !done.task))))
474+ |=(=task:todo task(done !done.task))
475+ ==
468− :~ [%give %fact ~[/updates] %todo-update !>(`update:todo`action)]
476+ :~ :* %give %fact ~[/updates] %todo-update
477+ !>(`update:todo`action)
478+ ==
469 ==
479 ==
470 ::
480 ::
471 %rename
481 %rename
482+ :_ %= state
483+ tasks %+ ~(jab by tasks)
484+ id.action
472− :_ state(tasks (~(jab by tasks) id.action |=(=task:todo task(name name.action))))
485+ |=(=task:todo task(name name.action))
486+ ==
473− :~ [%give %fact ~[/updates] %todo-update !>(`update:todo`action)]
487+ :~ :* %give %fact ~[/updates] %todo-update
488+ !>(`update:todo`action)
489+ ==
474 ==
490 ==
475− ::
476 %allow
491 %allow
477 `state(friends (~(put in friends) who.action))
492 `state(friends (~(put in friends) who.action))
478 ::
493 ::