mirror of
https://github.com/urbit/shrub.git
synced 2024-12-14 20:02:51 +03:00
Cleanup +find-or-create-ship-state
This commit is contained in:
parent
846439b88d
commit
164504d0a1
@ -1044,14 +1044,18 @@
|
||||
::+|
|
||||
::
|
||||
++ this .
|
||||
:: +find-or-create-ship-state: find or create a ford-state for a @p
|
||||
::
|
||||
:: Accesses and modifies :state-by-ship.
|
||||
::
|
||||
++ find-or-create-ship-state
|
||||
|= our=@p
|
||||
^- [ford-state _state-by-ship]
|
||||
::
|
||||
=/ existing (~(get by state-by-ship) our)
|
||||
?^ existing [u.existing state-by-ship]
|
||||
=? state-by-ship
|
||||
!(~(has by state-by-ship) our)
|
||||
(~(put by state-by-ship) our *ford-state)
|
||||
[(~(got by state-by-ship) our) state-by-ship]
|
||||
?^ existing
|
||||
[u.existing state-by-ship]
|
||||
::
|
||||
=| new-state=ford-state
|
||||
[new-state (~(put by state-by-ship) our new-state)]
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user