gall: clean up +mo-{bale, ball, come, chew}

This commit is contained in:
Jared Tobin 2019-04-12 08:24:24 +12:00 committed by Jared Tobin
parent 77b3eb6b4a
commit a2fd2e0ed7
No known key found for this signature in database
GPG Key ID: 0E4647D58F8A69E4

View File

@ -351,45 +351,69 @@
%pull mo-state %pull mo-state
== ==
:: ::
++ mo-bale :: assign outbone :: +mo-bale: assign an out bone.
|= him/ship ::
^- {@ud _+>} ++ mo-bale
=+ sad=(~(gut by sap.mas) him `scad`[1 ~ ~]) |= =ship
=+ nom=(~(get by q.sad) hen) ^- [@ud _mo-state]
?^ nom [u.nom +>.$] ::
:- p.sad =/ =scad
%_ +>.$ =/ default [1 ~ ~]
sap.mas =/ existing (~(get by sap.mas) ship)
%+ ~(put by sap.mas) him (fall existing default)
%_ sad ::
p +(p.sad) =/ nom (~(get by q.scad) hen)
q (~(put by q.sad) hen p.sad) ::
r (~(put by r.sad) p.sad hen) ?^ nom
[u.nom mo-state]
::
=/ index p.scad
::
=/ contacts
%_ scad
p +(index)
q (~(put by q.scad) hen index)
r (~(put by r.scad) index hen)
== ==
== ::
=/ new-state
%_ mo-state
sap.mas (~(put by sap.mas) ship contacts)
==
::
[index new-state]
:: ::
++ mo-ball :: outbone by index :: +mo-ball: retrieve an out bone by index.
|= {him/ship num/@ud} ::
++ mo-ball
|= [=ship index=@ud]
^- duct ^- duct
(~(got by r:(~(got by sap.mas) him)) num) ::
=/ conns (~(got by sap.mas) ship)
=/ duct r:conns
(~(got by duct) index)
:: ::
++ mo-come :: handle locally :: +mo-come: handle locally.
|= {her/ship caz/cush}
^+ +>
=+ pry=`prey`[%high [~ her]]
(mo-club p.caz pry q.caz)
:: ::
++ mo-coup :: back from mo-away ++ mo-come
|= {dap/dude him/ship cup/ares} |= [=ship =cush]
%^ mo-give %unto %coup ^+ mo-state
?~ cup ~ ::
[~ `tang`[[%leaf (trip p.u.cup)] q.u.cup]] =/ =prey [%high [~ ship]]
(mo-club p.cush prey q.cush)
:: ::
++ mo-chew :: reverse build path :: +mo-chew: reverse build path.
|= pax/path ::
++ mo-chew
|= =path
^- beak ^- beak
?> ?=({@ @ @ ~} pax) ::
[(slav %p i.pax) i.t.pax da+(slav %da i.t.t.pax)] ?> ?=([@ @ @ ~] path)
::
=/ ship (slav %p i.path)
=/ desk i.t.path
=/ case [%da (slav %da i.t.t.path)]
[p=ship q=desk r=case]
:: ::
++ mo-cyst :: take in /sys ++ mo-cyst :: take in /sys
~/ %mo-cyst ~/ %mo-cyst