on master help sign in
gall-guide: fix overly wide code

Co-authored-by: poprox <51337059+drbeefsupreme@users.noreply.github.com>

commitf51d617c2c26a6cc7bdb7ddff52c5b06a7865893 authortinnus-napbus <77721746+tinnus-napbus@users.noreply.github.com> dateSat 27 Nov 2021, 04:28 (5 years ago) parent166de36
2 files changed+59−17
content/docs/userspace/gall-guide/7-sur-and-marks.md+36−9 content/docs/userspace/gall-guide/8-subscriptions.md+23−8
content/docs/userspace/gall-guide/7-sur-and-marks.md+36−9
@@ -88,34 +88,61 @@ manner:
8888```hoon
8989++ on-poke
9090 |= [=mark =vase]
91− |^ ^- (quip card _this)
91+ ^- (quip card _this)
92+ |^
93+ ?> =(src.bowl our.bowl)
9294 ?+ mark (on-poke:def mark vase)
93− %noun
95+ %todo-action
9496 =^ cards state
9597 (handle-poke !<(action:todo vase))
9698 [cards this]
99+ ==
100+ ::
97101 ++ handle-poke
98102 |= =action:todo
99103 ^- (quip card _state)
100104 ?- -.action
101105 %add
102106 :_ state(tasks (~(put by tasks) now.bowl [name.action %.n]))
103− :~ [%give %fact ~[/updates] %noun !>(`update:todo`[%add now.bowl name.action])]
107+ :~ :* %give %fact ~[/updates] %todo-update
108+ !>(`update:todo`[%add now.bowl name.action])
109+ ==
104110 ==
105111 ::
106− %del
112+ %del
107113 :_ state(tasks (~(del by tasks) id.action))
108− :~ [%give %fact ~[/updates] %noun !>(`update:todo`action)]
114+ :~ :* %give %fact ~[/updates] %todo-update
115+ !>(`update:todo`action)
116+ ==
109117 ==
110118 ::
111119 %toggle
112− :_ state(tasks (~(jab by tasks) id.action |=(=task task(done !done.task))))
113− :~ [%give %fact ~[/updates] %noun !>(`update:todo`action)]
120+ :_ %= state
121+ tasks %+ ~(jab by tasks)
122+ id.action
123+ |=(=task:todo task(done !done.task))
124+ ==
125+ :~ :* %give %fact ~[/updates] %todo-update
126+ !>(`update:todo`action)
127+ ==
114128 ==
115129 ::
116130 %rename
117− :_ state(tasks (~(jab by tasks) id.action |=(=task task(name name.action))))
118− :~ [%give %fact ~[/updates] %noun !>(`update:todo`action)]
131+ :_ %= state
132+ tasks %+ ~(jab by tasks)
133+ id.action
134+ |=(=task:todo task(name name.action))
135+ ==
136+ :~ :* %give %fact ~[/updates] %todo-update
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]
119146 ==
120147 ==
121148 --
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.
455455 ?- -.action
456456 %add
457457 :_ state(tasks (~(put by tasks) now.bowl [name.action %.n]))
458− :~ [%give %fact ~[/updates] %todo-update !>(`update:todo`[%add now.bowl name.action])]
458+ :~ :* %give %fact ~[/updates] %todo-update
459+ !>(`update:todo`[%add now.bowl name.action])
460+ ==
459461 ==
460462 ::
461− %del
463+ %del
462464 :_ 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+ ==
464468 ==
465469 ::
466470 %toggle
467− :_ state(tasks (~(jab by tasks) id.action |=(=task:todo task(done !done.task))))
468− :~ [%give %fact ~[/updates] %todo-update !>(`update:todo`action)]
471+ :_ %= state
472+ tasks %+ ~(jab by tasks)
473+ id.action
474+ |=(=task:todo task(done !done.task))
475+ ==
476+ :~ :* %give %fact ~[/updates] %todo-update
477+ !>(`update:todo`action)
478+ ==
469479 ==
470480 ::
471481 %rename
472− :_ state(tasks (~(jab by tasks) id.action |=(=task:todo task(name name.action))))
473− :~ [%give %fact ~[/updates] %todo-update !>(`update:todo`action)]
482+ :_ %= state
483+ tasks %+ ~(jab by tasks)
484+ id.action
485+ |=(=task:todo task(name name.action))
486+ ==
487+ :~ :* %give %fact ~[/updates] %todo-update
488+ !>(`update:todo`action)
489+ ==
474490 ==
475− ::
476491 %allow
477492 `state(friends (~(put in friends) who.action))
478493 ::