diff options
Diffstat (limited to 'stdlib/source/library/lux/data/collection/array.lux')
-rw-r--r-- | stdlib/source/library/lux/data/collection/array.lux | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index 8a3d0db92..af865d541 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -8,9 +8,10 @@ [equivalence (#+ Equivalence)] [fold (#+ Fold)] [predicate (#+ Predicate)]] + [control + ["." maybe]] [data ["." product] - ["." maybe] [collection ["." list ("#\." fold)]]] [math @@ -36,7 +37,7 @@ (as_is)) (def: .public (empty size) - {#.doc (doc "An empty array of the specified size.")} + {#.doc (example "An empty array of the specified size.")} (All [a] (-> Nat (Array a))) (for {@.old (:assume ("jvm anewarray" "(java.lang.Object )" size)) @@ -109,7 +110,7 @@ #.None)) (def: .public (write! index value array) - {#.doc (doc "Mutate the array by writing a value to the specified index.")} + {#.doc (example "Mutate the array by writing a value to the specified index.")} (All [a] (-> Nat a (Array a) (Array a))) (for {@.old @@ -129,7 +130,7 @@ @.scheme ("scheme array write" index value array)})) (def: .public (delete! index array) - {#.doc (doc "Mutate the array by deleting the value at the specified index.")} + {#.doc (example "Mutate the array by deleting the value at the specified index.")} (All [a] (-> Nat (Array a) (Array a))) (if (n.< (size array) index) @@ -159,7 +160,7 @@ false)) (def: .public (update! index transform array) - {#.doc (doc "Mutate the array by updating the value at the specified index.")} + {#.doc (example "Mutate the array by updating the value at the specified index.")} (All [a] (-> Nat (-> a a) (Array a) (Array a))) (case (read index array) @@ -170,8 +171,8 @@ (write! index (transform value) array))) (def: .public (upsert! index default transform array) - {#.doc (doc "Mutate the array by updating the value at the specified index." - "If there is no value, update and write the default value given.")} + {#.doc (example "Mutate the array by updating the value at the specified index." + "If there is no value, update and write the default value given.")} (All [a] (-> Nat a (-> a a) (Array a) (Array a))) (write! index @@ -179,7 +180,7 @@ array)) (def: .public (copy! length src_start src_array dest_start dest_array) - {#.doc (doc "Writes the contents of one array into the other.")} + {#.doc (example "Writes the contents of one array into the other.")} (All [a] (-> Nat Nat (Array a) Nat (Array a) (Array a))) @@ -214,7 +215,7 @@ (n.- (..occupancy array) (..size array))) (def: .public (filter! p xs) - {#.doc (doc "Delete every item of the array that fails to satisfy the predicate.")} + {#.doc (example "Delete every item of the array that fails to satisfy the predicate.")} (All [a] (-> (Predicate a) (Array a) (Array a))) (list\fold (function (_ idx xs') @@ -230,7 +231,7 @@ (list.indices (size xs)))) (def: .public (find p xs) - {#.doc (doc "Yields the first item in the array that satisfies the predicate.")} + {#.doc (example "Yields the first item in the array that satisfies the predicate.")} (All [a] (-> (Predicate a) (Array a) (Maybe a))) (let [arr_size (size xs)] @@ -264,7 +265,7 @@ #.None)))) (def: .public (clone xs) - {#.doc (doc "Yields a shallow clone of the array.")} + {#.doc (example "Yields a shallow clone of the array.")} (All [a] (-> (Array a) (Array a))) (let [arr_size (size xs)] (list\fold (function (_ idx ys) @@ -289,7 +290,7 @@ (dec 0)) (def: .public (list array) - {#.doc (doc "Yields a list with every non-empty item in the array.")} + {#.doc (example "Yields a list with every non-empty item in the array.")} (All [a] (-> (Array a) (List a))) (loop [idx (dec (size array)) output #.End] @@ -307,7 +308,7 @@ output))))) (def: .public (list' default array) - {#.doc (doc "Like 'list', but uses the 'default' value when encountering an empty cell in the array.")} + {#.doc (example "Like 'list', but uses the 'default' value when encountering an empty cell in the array.")} (All [a] (-> a (Array a) (List a))) (loop [idx (dec (size array)) output #.End] |