diff options
Diffstat (limited to 'stdlib/source/library/lux/data/collection/row.lux')
-rw-r--r-- | stdlib/source/library/lux/data/collection/row.lux | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux index 7ce9802d6..4e341dfbd 100644 --- a/stdlib/source/library/lux/data/collection/row.lux +++ b/stdlib/source/library/lux/data/collection/row.lux @@ -74,7 +74,7 @@ (def: (new_hierarchy _) (All [a] (-> Any (Hierarchy a))) - (array.new full_node_size)) + (array.empty full_node_size)) (def: (tail_off row_size) (-> Nat Nat) @@ -94,7 +94,7 @@ (def: (new_tail singleton) (All [a] (-> a (Base a))) - (|> (array.new 1) + (|> (array.empty 1) (array.write! 0 singleton))) (def: (push_tail size level tail parent) @@ -122,7 +122,7 @@ (def: (expand_tail val tail) (All [a] (-> a (Base a) (Base a))) (let [tail_size (array.size tail)] - (|> (array.new (inc tail_size)) + (|> (array.empty (inc tail_size)) (array.copy! tail_size 0 tail 0) (array.write! tail_size val)))) @@ -178,7 +178,7 @@ (#Hierarchy hierarchy) (|> hierarchy array.to_list - list.reverse + list.reversed (list\fold (function (_ sub acc) (list\compose (to_list' sub) acc)) #.End)))) @@ -193,8 +193,8 @@ Row {#level (level_up root_level) #size 0 - #root (array.new full_node_size) - #tail (array.new 0)}) + #root (array.empty full_node_size) + #tail (array.empty 0)}) (def: #export (size row) (All [a] (-> (Row a) Nat)) @@ -314,7 +314,7 @@ new_tail_size (dec (array.size old_tail))] (|> row (update@ #size dec) - (set@ #tail (|> (array.new new_tail_size) + (set@ #tail (|> (array.empty new_tail_size) (array.copy! new_tail_size 0 old_tail 0))))) (maybe.assume (do maybe.monad @@ -465,9 +465,11 @@ (^open ".") ..monoid] (fold (function (_ post pre) (compose pre post)) identity)))) -(def: #export reverse +(def: #export reversed (All [a] (-> (Row a) (Row a))) - (|>> ..to_list list.reverse (list\fold add ..empty))) + (|>> ..to_list + list.reversed + (list\fold add ..empty))) (template [<name> <array> <init> <op>] [(def: #export <name> |