hoon: refactor unnecessary parameter to bif:by

This commit is contained in:
Alex Shelkovnykov 2023-06-04 04:32:36 +00:00
parent c0cb7d810a
commit fe34f55a04
2 changed files with 10 additions and 14 deletions

View File

@ -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)

View File

@ -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