diff options
author | Eduardo Julian | 2018-04-05 07:48:25 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-04-05 07:48:25 -0400 |
commit | 435771d3c4d4ffa791805e7006ee3bde488a4090 (patch) | |
tree | 693b9e2a6d8c6ddf4e439336e5bfcd665c9955cd /stdlib/source/lux/data/coll/dict.lux | |
parent | 3de94c8a341ef3f19fd75eeeb98e5333d2fe89d0 (diff) |
- Improved the syntax for the "lux.function" macro.
Diffstat (limited to 'stdlib/source/lux/data/coll/dict.lux')
-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 4c25216c4..97a119755 100644 --- a/stdlib/source/lux/data/coll/dict.lux +++ b/stdlib/source/lux/data/coll/dict.lux @@ -213,7 +213,7 @@ (def: (collision-index Hash<k> key colls) (All [k v] (-> (Hash k) k (Collisions k v) (Maybe Index))) (:: maybe.Monad<Maybe> map product.left - (array.find+ (function [idx [key' val']] + (array.find+ (function (_ idx [key' val']) (:: Hash<k> = key key')) colls))) @@ -221,7 +221,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 (function [idx [insertion-idx node]] + (product.right (list/fold (function (_ idx [insertion-idx node]) (let [[bitmap base] node] (case (array.read idx h-array) #.None [insertion-idx node] @@ -245,7 +245,7 @@ (Hash k) Level BitMap (Base k v) (Array (Node k v)))) - (product.right (list/fold (function [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) @@ -505,7 +505,7 @@ (array/fold n/+ +0 (array/map size' hierarchy)) (#Base _ base) - (array/fold n/+ +0 (array/map (function [sub-node'] + (array/fold n/+ +0 (array/map (function (_ sub-node') (case sub-node' (#.Left sub-node) (size' sub-node) (#.Right _) +1)) @@ -519,12 +519,12 @@ (All [k v] (-> (Node k v) (List [k v]))) (case node (#Hierarchy _size hierarchy) - (array/fold (function [sub-node tail] (list/compose (entries' sub-node) tail)) + (array/fold (function (_ sub-node tail) (list/compose (entries' sub-node) tail)) #.Nil hierarchy) (#Base bitmap base) - (array/fold (function [branch tail] + (array/fold (function (_ branch tail) (case branch (#.Left sub-node) (list/compose (entries' sub-node) tail) @@ -535,7 +535,7 @@ base) (#Collisions hash colls) - (array/fold (function [[key' val'] tail] (#.Cons [key' val'] tail)) + (array/fold (function (_ [key' val'] tail) (#.Cons [key' val'] tail)) #.Nil colls))) @@ -610,7 +610,7 @@ (def: #export (from-list Hash<k> kvs) (All [k v] (-> (Hash k) (List [k v]) (Dict k v))) - (list/fold (function [[k v] dict] + (list/fold (function (_ [k v] dict) (put k v dict)) (new Hash<k>) kvs)) @@ -629,7 +629,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 (function [[key val] dict] (put key val dict)) + (list/fold (function (_ [key val] dict) (put key val dict)) dict1 (entries dict2))) @@ -638,7 +638,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 (function [[key val2] dict] + (list/fold (function (_ [key val2] dict) (case (get key dict) #.None (put key val2 dict) @@ -663,7 +663,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 (function [key new-dict] + (list/fold (function (_ key new-dict) (case (get key dict) #.None new-dict (#.Some val) (put key val new-dict))) @@ -675,7 +675,7 @@ (def: (= test subject) (and (n/= (size test) (size subject)) - (list.every? (function [k] + (list.every? (function (_ k) (case [(get k test) (get k subject)] [(#.Some tk) (#.Some sk)] (:: Eq<v> = tk sk) |