diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/collection/array.lux | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/stdlib/source/lux/data/collection/array.lux b/stdlib/source/lux/data/collection/array.lux index 1a9e191a8..588c5132b 100644 --- a/stdlib/source/lux/data/collection/array.lux +++ b/stdlib/source/lux/data/collection/array.lux @@ -38,7 +38,7 @@ (All [a] (-> Nat Nat (Array a) Nat (Array a) (Array a))) - (if (n/= +0 length) + (if (n/= |0 length) dest-array (list/fold (function (_ offset target) (case (read (n/+ offset src-start) src-array) @@ -48,7 +48,7 @@ (#.Some value) (write (n/+ offset dest-start) value target))) dest-array - (list.n/range +0 (dec length))))) + (list.n/range |0 (dec length))))) (def: #export (occupied array) {#.doc "Finds out how many cells in an array are occupied."} @@ -60,7 +60,7 @@ (#.Some _) (inc count))) - +0 + |0 (list.indices (size array)))) (def: #export (vacant array) @@ -87,7 +87,7 @@ (All [a] (-> (-> a Bit) (Array a) (Maybe a))) (let [arr-size (size xs)] - (loop [idx +0] + (loop [idx |0] (if (n/< arr-size idx) (case (read idx xs) #.None @@ -104,7 +104,7 @@ (All [a] (-> (-> Nat a Bit) (Array a) (Maybe [Nat a]))) (let [arr-size (size xs)] - (loop [idx +0] + (loop [idx |0] (if (n/< arr-size idx) (case (read idx xs) #.None @@ -133,10 +133,10 @@ (All [a] (-> (List a) (Array a))) (product.right (list/fold (function (_ x [idx arr]) [(inc idx) (write idx x arr)]) - [+0 (new (list.size xs))] + [|0 (new (list.size xs))] xs))) -(def: underflow Nat (dec +0)) +(def: underflow Nat (dec |0)) (def: #export (to-list array) (All [a] (-> (Array a) (List a))) @@ -170,23 +170,23 @@ _ #0))) #1 - (list.n/range +0 (dec sxs))))) + (list.n/range |0 (dec sxs))))) )) (structure: #export Monoid<Array> (All [a] (Monoid (Array a))) - (def: identity (new +0)) + (def: identity (new |0)) (def: (compose xs ys) (let [sxs (size xs) sxy (size ys)] (|> (new (n/+ sxy sxs)) - (copy sxs +0 xs +0) - (copy sxy +0 ys sxs))))) + (copy sxs |0 xs |0) + (copy sxy |0 ys sxs))))) (structure: #export _ (Functor Array) (def: (map f ma) (let [arr-size (size ma)] - (if (n/= +0 arr-size) + (if (n/= |0 arr-size) (new arr-size) (list/fold (function (_ idx mb) (case (read idx ma) @@ -196,14 +196,14 @@ (#.Some x) (write idx (f x) mb))) (new arr-size) - (list.n/range +0 (dec arr-size))) + (list.n/range |0 (dec arr-size))) )))) (structure: #export _ (Fold Array) (def: (fold f init xs) (let [arr-size (size xs)] (loop [so-far init - idx +0] + idx |0] (if (n/< arr-size idx) (case (read idx xs) #.None @@ -218,7 +218,7 @@ (All [a] (-> (Predicate a) (Array a) Bit)) (let [size (..size array)] - (loop [idx +0] + (loop [idx |0] (if (n/< size idx) (case (..read idx array) (#.Some value) |