mirror of
https://github.com/urbit/shrub.git
synced 2024-11-23 20:26:54 +03:00
hoon: refactor unnecessary parameter to bif:by
This commit is contained in:
parent
c0cb7d810a
commit
fe34f55a04
@ -1422,23 +1422,19 @@
|
||||
::
|
||||
++ bif :: splits a by b
|
||||
~/ %bif
|
||||
|* [b=* c=*]
|
||||
^+ [l=a r=a]
|
||||
=< +
|
||||
|- ^+ a
|
||||
|* b=*
|
||||
|- ^+ [l=a r=a]
|
||||
?~ a
|
||||
[[b c] ~ ~]
|
||||
[~ ~]
|
||||
?: =(b p.n.a)
|
||||
?: =(c q.n.a)
|
||||
a
|
||||
a(n [b c])
|
||||
+.a
|
||||
?: (gor b p.n.a)
|
||||
=+ d=$(a l.a)
|
||||
?> ?=(^ d)
|
||||
d(r a(l r.d))
|
||||
[l.d a(l r.d)]
|
||||
=+ d=$(a r.a)
|
||||
?> ?=(^ d)
|
||||
d(l a(r l.d))
|
||||
[a(r l.d) r.d]
|
||||
::
|
||||
++ del :: delete at key b
|
||||
~/ %del
|
||||
@ -1463,7 +1459,7 @@
|
||||
|- ^+ a
|
||||
?~ b
|
||||
a
|
||||
=+ c=(bif p.n.b q.n.b)
|
||||
=+ c=(bif p.n.b)
|
||||
?> ?=(^ c)
|
||||
=+ d=$(a l.c, b l.b)
|
||||
=+ e=$(a r.c, b r.b)
|
||||
|
@ -177,14 +177,14 @@
|
||||
:: in both maps are the same as before, and that both returned
|
||||
:: maps are correct
|
||||
::
|
||||
=/ splits-a=[(map) (map)] (~(bif by m-des) [99 99])
|
||||
=/ splits-b=[(map) (map)] (~(bif by m-des) [6 12])
|
||||
=/ splits-a=[(map) (map)] (~(bif by m-des) 99)
|
||||
=/ splits-b=[(map) (map)] (~(bif by m-des) 6)
|
||||
;: weld
|
||||
:: Checks with empty map
|
||||
::
|
||||
%+ expect-eq
|
||||
!> [~ ~]
|
||||
!> (~(bif by m-nul) [1 2])
|
||||
!> (~(bif by m-nul) 1)
|
||||
:: Checks bifurcating by non-existing element
|
||||
::
|
||||
%+ expect-eq
|
||||
|
Loading…
Reference in New Issue
Block a user