aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/collection/set.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-01-12 17:31:48 -0400
committerEduardo Julian2021-01-12 17:31:48 -0400
commit5dbf134346424602b0104d1f749c1a9eac6f21af (patch)
treeac77441b9fcbc66a6f9ef1e5a55ccf0b1bcc996e /stdlib/source/lux/data/collection/set.lux
parent8aac0c573c29d2829242d66539a9e027d03ff8ec (diff)
Compiler now shows suggestions when encountering unknown definitions.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/collection/set.lux17
1 files changed, 9 insertions, 8 deletions
diff --git a/stdlib/source/lux/data/collection/set.lux b/stdlib/source/lux/data/collection/set.lux
index d0341b402..ca95a7a4b 100644
--- a/stdlib/source/lux/data/collection/set.lux
+++ b/stdlib/source/lux/data/collection/set.lux
@@ -2,16 +2,17 @@
[lux #*
[abstract
[equivalence (#+ Equivalence)]
+ [hash (#+ Hash)]
[predicate (#+ Predicate)]
- [monoid (#+ Monoid)]
- ["." hash (#+ Hash)]]
+ [monoid (#+ Monoid)]]
[data
[collection
- ["//" dictionary (#+ Dictionary)]
["." list ("#\." fold)]]]
[math
[number
- ["n" nat]]]])
+ ["n" nat]]]]
+ ["." // #_
+ ["#" dictionary (#+ Dictionary)]])
(type: #export (Set a)
(Dictionary a Any))
@@ -71,10 +72,10 @@
(def: &equivalence ..equivalence)
- (def: (hash (^@ set [hash _]))
- (list\fold (function (_ elem acc) (n.+ (\ hash hash elem) acc))
- 0
- (..to_list set))))
+ (def: (hash set)
+ (|> set
+ ..to_list
+ (\ (list.hash (..member_hash set)) hash))))
(structure: #export (monoid hash)
(All [a] (-> (Hash a) (Monoid (Set a))))