gall: separate put:of-grow to put-tend and put-grow

This commit is contained in:
pkova 2024-01-17 17:59:47 +02:00
parent 350e883ad6
commit 9236909cec

View File

@ -142,7 +142,7 @@
~
$(wer [i.path wer], path t.path, farm u.nex)
::
++ put
++ put-grow
|= [=path =plot]
^- (unit _farm)
?: ?=(%coop -.farm)
@ -155,10 +155,24 @@
?~ res ~
`farm(q (~(put by q.farm) i.path u.res))
::
++ put-tend
|= [=path =plot]
^- (unit _farm)
?: ?=(%coop -.farm)
`farm(q (~(put by q.farm) path plot))
?~ path
`farm(p `plot)
?~ nex=(~(get by q.farm) i.path)
~
=/ res
$(path t.path, farm u.nex)
?~ res ~
`farm(q (~(put by q.farm) i.path u.res))
::
++ grow
|= [=spur now=@da =page]
=/ ski (gut spur)
%+ put spur
%+ put-grow spur
=- ski(fan (put:on-path fan.ski -< -> &/page))
?~ las=(ram:on-path fan.ski)
[(fall bob.ski 1) now]
@ -258,6 +272,7 @@
?~ nex=(~(get by q.farm) i.path)
~
$(path t.path, farm u.nex)
::
++ tap-plot
=| wer=path
|- ^- (list [path plot])
@ -512,7 +527,7 @@
=/ sky=(list [=spur bob=@ud]) ~(tap by sky.u.yak)
|-
?~ sky farm
=. farm (need (~(put of-farm farm) spur.i.sky [`bob.i.sky ~]))
=. farm (need (~(put-tend of-farm farm) spur.i.sky [`bob.i.sky ~]))
$(sky t.sky)
==
::
@ -1424,7 +1439,7 @@
|= [=spur =page]
^+ ap-core
:: check here, and no-op, so that +need below does not crash
?: =(~ (ap-match-coop spur))
?: =(^ (ap-match-coop spur))
%. ap-core
%+ trace &
[leaf+"gall: {<agent-name>}: grow {<spur>} has coop, dropping"]~
@ -1455,7 +1470,7 @@
::
%& :: replace with hash
%- need
%+ ~(put of-farm sky.yoke) spur
%+ ~(put-grow of-farm sky.yoke) spur
u.old(fan (put:on-path fan.u.old yon u.val(q |/(shax (jam p.q.u.val)))))
==
:: +ap-cull: delete all bindings up to and including .case
@ -1491,7 +1506,7 @@
%. sky.yoke
%+ trace &
[leaf+"gall: {<agent-name>}: cull {<[case spur]>} invalid path structure"]~
%+ ~(put of-farm sky.yoke) spur :: delete all older paths
%+ ~(put-grow of-farm sky.yoke) spur :: delete all older paths
[`yon (lot:on-path fan.u.old `yon ~)]
:: +ap-from-internal: internal move to move.
::
@ -2692,7 +2707,7 @@
farm
=/ [=spur p=plot] i.ski
=; new
?~ nex=(~(put of-farm farm) spur new)
?~ nex=(~(put-tend of-farm farm) spur new)
~& %weird
!! :: shouldn't continue else loss of ref integrity
:: $(ski t.ski)