mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-04 13:19:48 +03:00
Adjust construct recursion logic.
This commit is contained in:
parent
cba2dfc8d0
commit
423f2bf00f
@ -6917,19 +6917,20 @@
|
||||
::
|
||||
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
|
||||
@ -6938,11 +6939,11 @@
|
||||
?: =(| 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
|
||||
@ -6975,29 +6976,17 @@
|
||||
:: 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
|
||||
::
|
||||
@ -7036,12 +7025,6 @@
|
||||
:: switch, $%
|
||||
::
|
||||
{$kelp *}
|
||||
:: if atom or unknown, probe
|
||||
::
|
||||
?@ top
|
||||
(probe 2 dummy)
|
||||
:: if cell, enter switch directly
|
||||
::
|
||||
(switch i.p.mod t.p.mod)
|
||||
::
|
||||
:: constant
|
||||
@ -7080,8 +7063,6 @@
|
||||
::
|
||||
{$vine *}
|
||||
%- decorate
|
||||
?@ top
|
||||
(probe 2 dummy)
|
||||
:^ %wtpt
|
||||
fetch-wing(axe (peg axe 2))
|
||||
construct:clear(top [%| %&], mod q.mod)
|
||||
|
Loading…
Reference in New Issue
Block a user