diff options
Diffstat (limited to 'stdlib/source/library/lux/data/collection/sequence.lux')
-rw-r--r-- | stdlib/source/library/lux/data/collection/sequence.lux | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index 060c5a255..55c782acf 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -118,7 +118,7 @@ (if (array.lacks? sub_idx parent) ... If so, set the path to the tail (..path (level_down level) tail) - (case (array.item sub_idx parent) + (when (array.item sub_idx parent) ... If not, push the tail onto the sub_node. {#Hierarchy sub_node} {#Hierarchy (with_tail size (level_down level) tail sub_node)} @@ -138,7 +138,7 @@ (def (hierarchy#has level idx val hierarchy) (All (_ a) (-> Level Index a (Hierarchy a) (Hierarchy a))) (let [sub_idx (branch_idx (i64.right_shifted level idx))] - (case (array.item sub_idx hierarchy) + (when (array.item sub_idx hierarchy) {#Hierarchy sub_node} (|> (array.clone hierarchy) (array.has! sub_idx {#Hierarchy (hierarchy#has (level_down level) idx val sub_node)})) @@ -165,7 +165,7 @@ (maybe#each (function (_ sub) (|> (array.clone hierarchy) (array.has! sub_idx {#Hierarchy sub}))) - (case (array.item sub_idx hierarchy) + (when (array.item sub_idx hierarchy) {#Hierarchy sub} (without_tail size (level_down level) sub) @@ -180,7 +180,7 @@ (def (node#list node) (All (_ a) (-> (Node a) (List a))) - (case node + (when node {#Base base} (array.list {.#None} base) @@ -264,7 +264,7 @@ (let [index (branch_idx (i64.right_shifted level idx))] (if (array.lacks? index hierarchy) (exception.except ..base_was_not_found []) - (case [(n.> branching_exponent level) + (when [(n.> branching_exponent level) (array.item index hierarchy)] [.true {#Hierarchy sub}] (again (level_down level) sub) @@ -307,7 +307,7 @@ (def .public (prefix sequence) (All (_ a) (-> (Sequence a) (Sequence a))) - (case (the #size sequence) + (when (the #size sequence) 0 empty @@ -332,7 +332,7 @@ (with_expansions [<else> [level root]] (if (n.> branching_exponent level) (if (array.lacks? 1 root) - (case (array.item 0 root) + (when (array.item 0 root) {#Hierarchy sub_node} (again (level_down level) sub_node) @@ -375,7 +375,7 @@ (All (_ a) (-> (Equivalence a) (Equivalence (Node a)))) (implementation (def (= v1 v2) - (case [v1 v2] + (when [v1 v2] [{#Base b1} {#Base b2}] (array.= //#= b1 b2) @@ -400,7 +400,7 @@ (Mix Node) (implementation (def (mix $ init xs) - (case xs + (when xs {#Base base} (array.mix (function (_ _ item output) ($ item output)) init @@ -434,7 +434,7 @@ (Functor Node) (implementation (def (each $ xs) - (case xs + (when xs {#Base base} {#Base (array.each $ base)} @@ -491,7 +491,7 @@ (let [help (is (All (_ a) (-> (Predicate a) (Node a) Bit)) (function (help predicate node) - (case node + (when node {#Base base} (<array> predicate base) @@ -518,7 +518,7 @@ (def (one|node check items) (All (_ a b) (-> (-> a (Maybe b)) (Node a) (Maybe b))) - (case items + (when items {#Base items} (array.one check items) @@ -528,7 +528,7 @@ (def .public (one check items) (All (_ a b) (-> (-> a (Maybe b)) (Sequence a) (Maybe b))) - (case (let [... TODO: This binding was established to get around a compilation error. Fix and inline! + (when (let [... TODO: This binding was established to get around a compilation error. Fix and inline! check (..one|node check)] (|> items (the #root) |