diff --git a/gen/ford-turbo.hoon b/gen/ford-turbo.hoon index 93a42fab44..46daa433dc 100644 --- a/gen/ford-turbo.hoon +++ b/gen/ford-turbo.hoon @@ -81,10 +81,7 @@ ~& %test-literal =^ moves ford %- call:ford - :* duct=~ - type=~ - %make - ~nul + :* duct=~ type=~ %make ~nul plan=[%$ %noun !>(**)] date=`~1234.5.6 == @@ -101,10 +98,7 @@ ~& %test-autocons-same =^ moves ford %- call:ford - :* duct=~ - type=~ - %make - ~nul + :* duct=~ type=~ %make ~nul plan=[[%$ %noun !>(**)] [%$ %noun !>(**)]] date=`~1234.5.6 == @@ -125,10 +119,7 @@ ~& %test-autocons-different =^ moves ford %- call:ford - :* duct=~ - type=~ - %make - ~nul + :* duct=~ type=~ %make ~nul plan=[[%$ %noun !>(42)] [%$ %noun !>(43)]] date=`~1234.5.6 == @@ -147,23 +138,13 @@ :: ++ test-scry-clay-succeed ~& %test-scry-clay-succeed - =/ scry - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - ?> =(term %cx) - ?> =(beam [[~nul %desk %da ~1234.5.6] /foo/bar]) - :: - [~ ~ %noun !>(42)] + =/ scry (scry-succeed ~1234.5.6 [%noun !>(42)]) :: =. ford (ford-turbo now=~1234.5.6 eny=0xdead.beef scry=scry) =^ moves ford %- call:ford - :* duct=~ - type=~ - %make - ~nul - plan=[%scry %clay-once ren=%x bem=[[~nul %desk %da ~1234.5.6] /foo/bar]] + :* duct=~ type=~ %make ~nul + plan=[%scry %clay-once ren=%x bem=[[~nul %desk %da ~1234.5.6] /bar/foo]] date=`~1234.5.6 == %+ welp @@ -179,22 +160,12 @@ :: ++ test-scry-clay-fail ~& %test-scry-clay-fail - =/ scry - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - ?> =(term %cx) - ?> =(beam [[~nul %desk %da ~1234.5.6] /bar/foo]) - :: - [~ ~] + =/ scry (scry-fail ~1234.5.6) :: =. ford (ford-turbo now=~1234.5.6 eny=0xdead.beef scry=scry) =^ moves ford %- call:ford - :* duct=~ - type=~ - %make - ~nul + :* duct=~ type=~ %make ~nul plan=[%scry %clay-once ren=%x bem=[[~nul %desk %da ~1234.5.6] /bar/foo]] date=`~1234.5.6 == @@ -212,31 +183,12 @@ :: ++ test-scry-clay-block ~& %test-scry-clay-block - =/ scry-block - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - ?> =(term %cx) - ?> =(beam [[~nul %desk %da ~1234.5.6] /bar/foo]) - :: - ~ - :: scry-is-forbidden: makes sure ford does not attempt to scry + =/ scry-blocked (scry-block ~1234.5.6) :: - =/ scry-is-forbidden - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - ~| term+term - ~| beam+beam - !! - :: - =. ford (ford-turbo now=~1234.5.6 eny=0xdead.beef scry=scry-block) + =. ford (ford-turbo now=~1234.5.6 eny=0xdead.beef scry=scry-blocked) =^ moves ford %- call:ford - :* duct=~ - type=~ - %make - ~nul + :* duct=~ type=~ %make ~nul plan=[%scry %clay-once ren=%x bem=[[~nul %desk %da ~1234.5.6] /bar/foo]] date=`~1234.5.6 == @@ -271,34 +223,14 @@ :: ++ test-scry-clay-live ~& %test-scry-clay-live - =/ scry-42 - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - ?> =(term %cx) - ?> =(beam [[~nul %desk %da ~1234.5.6] /foo/bar]) - ~& %scry-42 - :: - [~ ~ %noun !>(42)] - :: - =/ scry-43 - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - :: - ?> =(term %cx) - ?> =(beam [[~nul %desk %da ~1234.5.7] /foo/bar]) - ~& %scry-43 - :: - [~ ~ %noun !>(43)] + =/ scry-42 (scry-succeed ~1234.5.6 [%noun !>(42)]) + =/ scry-43 (scry-succeed ~1234.5.7 [%noun !>(43)]) :: =. ford (ford-turbo now=~1234.5.6 eny=0xdead.beef scry=scry-42) =^ moves ford %- call:ford - :* duct=~ - type=~ - %make - ~nul - plan=[%scry %clay-live care=%x bel=[[~nul %desk] /foo/bar]] + :* duct=~ type=~ %make ~nul + plan=[%scry %clay-live care=%x bel=[[~nul %desk] /bar/foo]] date=~ == %+ welp @@ -330,4 +262,53 @@ == == :::- state-by-ship.+>+<.ford ::(my [~nul *ford-state:ford-turbo]~) +:: +:: |utilities: helper arms +:: +::+| utilities +:: +:: +scry-succeed: produces a scry function with a known request and answer +:: +++ scry-succeed + |= [date=@da result=cage] ^- sley + |= [* (unit (set monk)) =term =beam] + ^- (unit (unit cage)) + :: + ~| scry-succeed+[beam+beam term+term] + ?> =(term %cx) + ?> =(beam [[~nul %desk %da date] /bar/foo]) + :: + [~ ~ result] +:: +scry-fail: produces a scry function with a known request and failed answer +:: +++ scry-fail + |= date=@da ^- sley + |= [* (unit (set monk)) =term =beam] + ^- (unit (unit cage)) + :: + ~| scry-fail+[beam+beam term+term] + ?> =(term %cx) + ?> =(beam [[~nul %desk %da date] /bar/foo]) + :: + [~ ~] +:: +scry-block: produces a scry function with known request and blocked answer +:: +++ scry-block + |= date=@da ^- sley + |= [* (unit (set monk)) =term =beam] + ^- (unit (unit cage)) + :: + ~| scry-block+[beam+beam term+term] + ?> =(term %cx) + ?> =(beam [[~nul %desk %da date] /bar/foo]) + :: + ~ +:: +scry-is-forbidden: makes sure ford does not attempt to scry +:: +++ scry-is-forbidden ^- sley + |= [* (unit (set monk)) =term =beam] + ^- (unit (unit cage)) + :: + ~| scry-is-forbidden+[beam+beam term+term] + !! -- diff --git a/lib/ford-turbo.hoon b/lib/ford-turbo.hoon index b222cf92c3..91591cdd63 100644 --- a/lib/ford-turbo.hoon +++ b/lib/ford-turbo.hoon @@ -910,36 +910,29 @@ ++ to-wire |= =dependency ^- wire - |^ ?- -.dependency - :: - %clay-live - :: - =/ beam=beam - [[ship=p.p.bel desk=q.p.bel case=[%ud 0]] spur=q.bel]:dependency - :: - (encode %c care.dependency & beam) + :: + =/ beam=beam + ?- -.dependency + ?(%clay-once %gall-once) beam.dependency + ?(%clay-live %gall-live) :: - %clay-once - :: - (encode %c care.dependency | beam.dependency) - :: - %gall-live - =/ beam=beam - [[ship=p.p.bel desk=q.p.bel case=[%ud 0]] spur=q.bel]:dependency - :: - (encode %g care.dependency & beam) - :: - %gall-once - :: - (encode %g care.dependency | beam.dependency) + =, bel.dependency + [[ship=p.p desk=q.p case=[%ud 0]] spur=q] + == + :: + |^ ?- -.dependency + %clay-live (encode %c &) + %clay-once (encode %c |) + %gall-live (encode %g &) + %gall-once (encode %g |) == :: +encode:to-wire: encode :vane, :care, :live, and :beam into a +wire :: ++ encode - |= [vane=?(%c %g) care=care:clay live=? =beam] + |= [vane=?(%c %g) live=?] ^- wire :: - [vane care (scot %f live) (en-beam beam)] + [vane care.dependency (scot %f live) (en-beam beam)] -- :: +from-wire: decode a +dependency from a +wire :: @@ -1098,7 +1091,7 @@ %+ roll ~(tap in care-paths) |= [[care=care:clay =path] dependency-updates=_dependency-updates.state] :: - =/ dependency=dependency [%clay-live care bel=[disc spur=path]] + =/ dependency=dependency [%clay-live care bel=[disc spur=(flop path)]] :: =- (~(put by dependency-updates) date -) =- (~(put ju -) disc dependency) @@ -1801,7 +1794,7 @@ |= =dependency ^- (unit [care:clay path]) ?: ?=(?(%gall-live %gall-once) -.dependency) ~ - =- `[care.dependency -] + =- `[care.dependency (flop `path`-)] ?- -.dependency %clay-live spur=q.bel.dependency %clay-once spur=s.beam.dependency