mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 14:42:02 +03:00
reverted nap:to bugfix because we depend on its brokenness
This commit is contained in:
parent
46c9247347
commit
c04d06f905
@ -1875,10 +1875,9 @@
|
||||
::
|
||||
++ nap :: removes head
|
||||
?> ?=(^ a)
|
||||
?~ a ~
|
||||
=+ b=get
|
||||
?~ q.b ~
|
||||
bal(a ^+(a [n=n.q.b l=l.q.b r=r.q.b]))
|
||||
?: =(~ l.a) r.a
|
||||
=+ b=get(a l.a)
|
||||
bal(a ^+(a [p.b q.b r.a]))
|
||||
::
|
||||
++ put :: insert new tail
|
||||
|* b/*
|
||||
|
@ -1,51 +0,0 @@
|
||||
:: test a fix for a bug in +nap:to affecting three-item queues.
|
||||
::
|
||||
:: (see https://github.com/urbit/arvo/issues/1100 for details)
|
||||
::
|
||||
:: the test creates several queues from known lists and recursively
|
||||
:: unqueues the top, comparing it with the current element of the list.
|
||||
::
|
||||
/+ *test
|
||||
::
|
||||
=/ descending ~[7 6 5 4 3 2 1]
|
||||
=/ ascending ~[1 2 3 4 5 6 7]
|
||||
=/ unsorted ~[1 6 3 5 7 2 4]
|
||||
=/ duplicates ~[1 1 7 4 6 9 4]
|
||||
::
|
||||
=>
|
||||
|%
|
||||
++ unqueue
|
||||
|= [queue=(qeu @) test=(list @)]
|
||||
^- tang
|
||||
%- zing
|
||||
|- ^- (list tang)
|
||||
?~ test ~
|
||||
?~ queue ~
|
||||
:_ $(queue ~(nap to queue), test t.test)
|
||||
%+ expect-eq
|
||||
!> (need ~(top to queue))
|
||||
!> i.test
|
||||
--
|
||||
::
|
||||
|%
|
||||
::
|
||||
++ test-descending-sorted-list ^- tang
|
||||
::
|
||||
=+ queue=(~(gas to `(qeu @)`~) descending)
|
||||
(unqueue [queue descending])
|
||||
::
|
||||
++ test-ascending-sorted-list ^- tang
|
||||
::
|
||||
=+ queue=(~(gas to `(qeu @)`~) ascending)
|
||||
(unqueue [queue ascending])
|
||||
::
|
||||
++ test-unsorted-list ^- tang
|
||||
::
|
||||
=+ queue=(~(gas to `(qeu @)`~) unsorted)
|
||||
(unqueue [queue unsorted])
|
||||
::
|
||||
++ test-duplicates-list ^- tang
|
||||
::
|
||||
=+ queue=(~(gas to `(qeu @)`~) duplicates)
|
||||
(unqueue [queue duplicates])
|
||||
--
|
Loading…
Reference in New Issue
Block a user