Skip to content

Commit

Permalink
Merge pull request #2 from stefan-hoeck/enqueue_all
Browse files Browse the repository at this point in the history
[ new ] add enqueueAll utility
  • Loading branch information
stefan-hoeck authored Oct 28, 2023
2 parents 9e1c624 + 01abe0a commit b99c353
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Data/Queue.idr
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ export
enqueue : Queue a -> a -> Queue a
enqueue (Q f b) v = Q f (b :< v)

||| Append a list of values at the back of the queue. O(1)
export
enqueueAll : Queue a -> List a -> Queue a
enqueueAll (Q f b) vs = Q f (b <>< vs)

||| Take a value from the front of the queue.
|||
||| In case of the front being empty, this transfers
Expand Down

0 comments on commit b99c353

Please sign in to comment.