Adjust construct recursion logic.
::
fin
::
- ++ probe
- :: probe for tuple
+ ++ construct
+ :: local constructor
::
- |= $: :: tow: tuple width we need
- :: any: default if probe fails
+ :: ~& [%construct axe mod]
+ ~+
+ ^- hoon
+ :: tow: width of ideal tuple
::
- tow/@ud
- any/crib
+ =/ tow/@ud
+ ?+ mod 1
+ {^ *} 2
+ {$kelp *} 2
+ {$vine *} 2
==
- :: yad: topographic map of correct tuple width
- ::
- =/ yad/tope
- |-(?:(=(1 tow) & [& $(tow (dec tow))]))
:: joy: tuple test (~ fails, [~ ~] succeeds, [~ ~ ~] needs test)
::
=/ joy
?: =(| top) ~
?: =(& top) [~ ~ ~]
$(top +.top, tow (dec tow))
- :: boc: construct against full tuple
+ :: boc: construction given ideal subject
::
- =/ boc/hoon construct(top yad)
+ =; boc
?: =([~ ~] joy)
- :: no test needed
+ :: width is already ideal
::
boc
:: mac: matching crib
:: conditional build
::
[%tsgr [%wtcl [%wtts yum fetch-wing] [%$ 1] luz] boc]
+ :: idealize topography (should be a smarter merge)
::
- ++ construct
- :: local constructor
- ::
- :: ~& [%construct axe mod]
- ~+
- ^- hoon
+ =. top ?:(=(1 tow) top |-(?:(=(1 tow) & [& $(tow (dec tow))])))
?- mod
::
:: cell
::
{^ *}
- :: apply help
- ::
%- decorate
- :: probe unless we know the sample is a cell
- ::
- ?@ top
- (probe 2 dummy)
- :: if known cell, descend directly
- ::
- :- construct:clear(mod -.mod, top p.top, axe (peg axe 2))
- construct:clear(mod +.mod, top q.top, axe (peg axe 3))
+ :- construct:clear(mod -.mod, top -.top, axe (peg axe 2))
+ construct:clear(mod +.mod, top +.top, axe (peg axe 3))
::
:: base
::
:: switch, $%
::
{$kelp *}
- :: if atom or unknown, probe
- ::
- ?@ top
- (probe 2 dummy)
- :: if cell, enter switch directly
- ::
(switch i.p.mod t.p.mod)
::
:: constant
::
{$vine *}
%- decorate
- ?@ top
- (probe 2 dummy)
:^ %wtpt
fetch-wing(axe (peg axe 2))
construct:clear(top [%| %&], mod q.mod)
