diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/coll/dict.lux | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/lux/data/coll/dict.lux b/stdlib/source/lux/data/coll/dict.lux index 72a549759..ecd470ef9 100644 --- a/stdlib/source/lux/data/coll/dict.lux +++ b/stdlib/source/lux/data/coll/dict.lux @@ -215,7 +215,7 @@ (def: (collision-index Hash<K> key colls) (All [K V] (-> (Hash K) K (Collisions K V) (Maybe Index))) (:: Monad<Maybe> map product;left - (array;find+ (lambda [idx [key' val']] + (array;find+ (function [idx [key' val']] (:: Hash<K> = key key')) colls))) @@ -223,7 +223,7 @@ ## nodes to save space. (def: (demote-hierarchy except-idx [h-size h-array]) (All [k v] (-> Index (Hierarchy k v) [BitMap (Base k v)])) - (product;right (List/fold (lambda [idx [insertion-idx node]] + (product;right (List/fold (function [idx [insertion-idx node]] (let [[bitmap base] node] (case (array;get idx h-array) #;None [insertion-idx node] @@ -248,7 +248,7 @@ (Hash K) Level BitMap (Base K V) (Array (Node K V)))) - (product;right (List/fold (lambda [hierarchy-idx (^@ default [base-idx h-array])] + (product;right (List/fold (function [hierarchy-idx (^@ default [base-idx h-array])] (if (bit-position-is-set? (->bit-position hierarchy-idx) bitmap) [(n.inc base-idx) @@ -512,7 +512,7 @@ (Array/fold n.+ +0 (Array/map size' hierarchy)) (#Base _ base) - (Array/fold n.+ +0 (Array/map (lambda [sub-node'] + (Array/fold n.+ +0 (Array/map (function [sub-node'] (case sub-node' (#;Left sub-node) (size' sub-node) (#;Right _) +1)) @@ -526,12 +526,12 @@ (All [K V] (-> (Node K V) (List [K V]))) (case node (#Hierarchy _size hierarchy) - (Array/fold (lambda [sub-node tail] (List/append (entries' sub-node) tail)) + (Array/fold (function [sub-node tail] (List/append (entries' sub-node) tail)) #;Nil hierarchy) (#Base bitmap base) - (Array/fold (lambda [branch tail] + (Array/fold (function [branch tail] (case branch (#;Left sub-node) (List/append (entries' sub-node) tail) @@ -542,7 +542,7 @@ base) (#Collisions hash colls) - (Array/fold (lambda [[key' val'] tail] (#;Cons [key' val'] tail)) + (Array/fold (function [[key' val'] tail] (#;Cons [key' val'] tail)) #;Nil colls))) @@ -609,7 +609,7 @@ (def: #export (from-list Hash<K> kvs) (All [K V] (-> (Hash K) (List [K V]) (Dict K V))) - (List/fold (lambda [[k v] dict] + (List/fold (function [[k v] dict] (put k v dict)) (new Hash<K>) kvs)) @@ -628,7 +628,7 @@ If any collisions with keys occur, the values of dict2 will overwrite those of dict1."} (All [K V] (-> (Dict K V) (Dict K V) (Dict K V))) - (List/fold (lambda [[key val] dict] (put key val dict)) + (List/fold (function [[key val] dict] (put key val dict)) dict1 (entries dict2))) @@ -637,7 +637,7 @@ If any collisions with keys occur, a new value will be computed by applying 'f' to the values of dict2 and dict1."} (All [K V] (-> (-> V V V) (Dict K V) (Dict K V) (Dict K V))) - (List/fold (lambda [[key val2] dict] + (List/fold (function [[key val2] dict] (case (get key dict) #;None (put key val2 dict) @@ -662,7 +662,7 @@ {#;doc "Creates a sub-set of the given dict, with only the specified keys."} (All [K V] (-> (List K) (Dict K V) (Dict K V))) (let [[Hash<K> _] dict] - (List/fold (lambda [key new-dict] + (List/fold (function [key new-dict] (case (get key dict) #;None new-dict (#;Some val) (put key val new-dict))) @@ -674,7 +674,7 @@ (def: (= test subject) (and (n.= (size test) (size subject)) - (list;every? (lambda [k] + (list;every? (function [k] (case [(get k test) (get k subject)] [(#;Some tk) (#;Some sk)] (:: Eq<v> = tk sk) |