diff options
Diffstat (limited to 'stdlib/source/lux/data/struct/queue.lux')
-rw-r--r-- | stdlib/source/lux/data/struct/queue.lux | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/stdlib/source/lux/data/struct/queue.lux b/stdlib/source/lux/data/struct/queue.lux index e22f0bb81..1c7fcdc3e 100644 --- a/stdlib/source/lux/data/struct/queue.lux +++ b/stdlib/source/lux/data/struct/queue.lux @@ -43,13 +43,13 @@ (All [a] (-> (Queue a) Bool)) (|>. (get@ [#front]) list;empty?)) -(def: #export (enqueued? a/Eq queue member) +(def: #export (member? a/Eq queue member) (All [a] (-> (Eq a) (Queue a) a Bool)) (let [(^slots [#front #rear]) queue] (or (list;member? a/Eq front member) (list;member? a/Eq rear member)))) -(def: #export (dequeue queue) +(def: #export (pop queue) (All [a] (-> (Queue a) (Queue a))) (case (get@ #front queue) (^ (list)) ## Empty... @@ -64,7 +64,7 @@ (|> queue (set@ #front front')))) -(def: #export (enqueue val queue) +(def: #export (push val queue) (All [a] (-> a (Queue a) (Queue a))) (case (get@ #front queue) #;Nil @@ -74,6 +74,7 @@ (update@ #rear (|>. (#;Cons val)) queue))) ## [Structures] -(struct: #export (Eq<Queue> Eq<a>) (All [a] (-> (Eq a) (Eq (Queue a)))) +(struct: #export (Eq<Queue> Eq<a>) + (All [a] (-> (Eq a) (Eq (Queue a)))) (def: (= qx qy) (:: (list;Eq<List> Eq<a>) = (to-list qx) (to-list qy)))) |