diff options
Diffstat (limited to 'stdlib/source/library/lux/data/collection/queue.lux')
-rw-r--r-- | stdlib/source/library/lux/data/collection/queue.lux | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux index e8ed4c145..81eb6092c 100644 --- a/stdlib/source/library/lux/data/collection/queue.lux +++ b/stdlib/source/library/lux/data/collection/queue.lux @@ -1,15 +1,15 @@ (.using - [library - [lux {"-" list} - [abstract - [equivalence {"+" Equivalence}] - [functor {"+" Functor}]] - [data - [collection - ["[0]" list ("[1]#[0]" monoid functor)]]] - [math - [number - ["n" nat]]]]]) + [library + [lux {"-" list} + [abstract + [equivalence {"+" Equivalence}] + [functor {"+" Functor}]] + [data + [collection + ["[0]" list ("[1]#[0]" monoid functor)]]] + [math + [number + ["n" nat]]]]]) (type: .public (Queue a) (Record @@ -33,7 +33,7 @@ (def: .public front (All (_ a) (-> (Queue a) (Maybe a))) - (|>> (value@ #front) list.head)) + (|>> (the #front) list.head)) (def: .public (size queue) (All (_ a) (-> (Queue a) Nat)) @@ -43,7 +43,7 @@ (def: .public empty? (All (_ a) (-> (Queue a) Bit)) - (|>> (value@ #front) list.empty?)) + (|>> (the #front) list.empty?)) (def: .public (member? equivalence queue member) (All (_ a) (-> (Equivalence a) (Queue a) a Bit)) @@ -53,7 +53,7 @@ (def: .public (next queue) (All (_ a) (-> (Queue a) (Queue a))) - (case (value@ #front queue) + (case (the #front queue) ... Empty... (^ (.list)) queue @@ -61,22 +61,22 @@ ... Front has dried up... (^ (.list _)) (|> queue - (with@ #front (list.reversed (value@ #rear queue))) - (with@ #rear (.list))) + (has #front (list.reversed (the #rear queue))) + (has #rear (.list))) ... Consume front! (^ (.list& _ front')) (|> queue - (with@ #front front')))) + (has #front front')))) (def: .public (end val queue) (All (_ a) (-> a (Queue a) (Queue a))) - (case (value@ #front queue) + (case (the #front queue) {.#End} - (with@ #front (.list val) queue) + (has #front (.list val) queue) _ - (revised@ #rear (|>> {.#Item val}) queue))) + (revised #rear (|>> {.#Item val}) queue))) (implementation: .public (equivalence super) (All (_ a) (-> (Equivalence a) (Equivalence (Queue a)))) @@ -90,5 +90,5 @@ (Functor Queue) (def: (each f fa) - [#front (|> fa (value@ #front) (list#each f)) - #rear (|> fa (value@ #rear) (list#each f))])) + [#front (|> fa (the #front) (list#each f)) + #rear (|> fa (the #rear) (list#each f))])) |