Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1132 from urbit/hotfix
Browse files Browse the repository at this point in the history
Hotfix
  • Loading branch information
ixv authored Apr 3, 2019
2 parents fc2e45b + 14691da commit e394919
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/talk.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -2098,7 +2098,7 @@
:: render circle (as glyph if we can).
?~ moy
=+ cha=(~(get by bound) one ~ ~)
=- ?~(cha - "{u.cha ~} {-}")
=- ?~(cha - "{u.cha ~}")
~(cr-phat cr one)
(~(cr-curt cr one) u.moy)
--
Expand Down
7 changes: 4 additions & 3 deletions sys/hoon.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -1875,9 +1875,10 @@
::
++ nap :: removes head
?> ?=(^ a)
?: =(~ l.a) r.a
=+ b=get(a l.a)
bal(a ^+(a [p.b q.b r.a]))
?~ a ~
=+ b=get
?~ q.b ~
bal(a ^+(a [n=n.q.b l=l.q.b r=r.q.b]))
::
++ put :: insert new tail
|* b/*
Expand Down
51 changes: 51 additions & 0 deletions tests/sys/hoon/qeu.hoon
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
:: 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])
--

0 comments on commit e394919

Please sign in to comment.