From ce8f9d00fb058ac2250eb149d82f30930ff72a3e Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 17 Sep 2021 15:30:21 +1000 Subject: [PATCH] hood: respect ordering of agents in bill --- pkg/base-dev/sur/hood.hoon | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pkg/base-dev/sur/hood.hoon b/pkg/base-dev/sur/hood.hoon index 6de54e5716..ac2ab3c040 100644 --- a/pkg/base-dev/sur/hood.hoon +++ b/pkg/base-dev/sur/hood.hoon @@ -143,6 +143,20 @@ :: +is-fish: should dill link .dude? :: ++ is-fish |=([=dude =bill] .?((find ~[dude] (read-fish bill)))) +:: +tap-in-bill: +tap:in, respecting the order of agents in the bill +:: +++ tap-in-bill + |= [=bill dudes=(set dude)] + =/ apes (read-apes bill) + |^ + %+ sort ~(tap in dudes) + |= [a=dude b=dude] + (lte (idx a) (idx b)) + :: + ++ idx + |= =dude + (fall (bind (find ~[dude] apes) succ) 0) + -- :: +get-apps-diff: which agents should be started and stopped :: ++ get-apps-diff @@ -151,8 +165,8 @@ =/ =bill (read-bill our desk now) =/ wan (sy (get-apps-want bill rein)) =/ hav (sy (get-apps-live our desk now)) - =/ liv ~(tap in (~(dif in wan) hav)) - =/ ded ~(tap in (~(dif in hav) wan)) + =/ liv (tap-in-bill bill (~(dif in wan) hav)) + =/ ded (flop (tap-in-bill bill (~(dif in hav) wan))) [liv ded] :: ++ get-apps-live