diff options
Diffstat (limited to 'stdlib/source/library/lux/data/collection/set/ordered.lux')
-rw-r--r-- | stdlib/source/library/lux/data/collection/set/ordered.lux | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux index 97e32646c..8f2992ebc 100644 --- a/stdlib/source/library/lux/data/collection/set/ordered.lux +++ b/stdlib/source/library/lux/data/collection/set/ordered.lux @@ -12,21 +12,21 @@ [type abstract]]]) -(abstract: #export (Set a) - (/.Dictionary a a) - +(abstract: .public (Set a) {#.doc (doc "A set with ordered entries.")} - (def: #export empty + (/.Dictionary a a) + + (def: .public empty (All [a] (-> (Order a) (Set a))) (|>> /.empty :abstraction)) - (def: #export (member? set elem) + (def: .public (member? set elem) (All [a] (-> (Set a) a Bit)) (/.key? (:representation set) elem)) (template [<type> <name> <alias>] - [(def: #export <name> + [(def: .public <name> (All [a] (-> (Set a) <type>)) (|>> :representation <alias>))] @@ -36,39 +36,39 @@ [Bit empty? /.empty?] ) - (def: #export (add elem set) + (def: .public (add elem set) (All [a] (-> a (Set a) (Set a))) (|> set :representation (/.put elem elem) :abstraction)) - (def: #export (remove elem set) + (def: .public (remove elem set) (All [a] (-> a (Set a) (Set a))) (|> set :representation (/.remove elem) :abstraction)) - (def: #export list + (def: .public list (All [a] (-> (Set a) (List a))) (|>> :representation /.keys)) - (def: #export (of_list &order list) + (def: .public (of_list &order list) (All [a] (-> (Order a) (List a) (Set a))) (list\fold add (..empty &order) list)) - (def: #export (union left right) + (def: .public (union left right) (All [a] (-> (Set a) (Set a) (Set a))) (list\fold ..add right (..list left))) - (def: #export (intersection left right) + (def: .public (intersection left right) (All [a] (-> (Set a) (Set a) (Set a))) (|> (..list right) (list.only (..member? left)) (..of_list (get@ #/.&order (:representation right))))) - (def: #export (difference param subject) + (def: .public (difference param subject) (All [a] (-> (Set a) (Set a) (Set a))) (|> (..list subject) (list.only (|>> (..member? param) not)) (..of_list (get@ #/.&order (:representation subject))))) - (implementation: #export equivalence + (implementation: .public equivalence (All [a] (Equivalence (Set a))) (def: (= reference sample) @@ -76,14 +76,14 @@ = (..list reference) (..list sample)))) ) -(def: #export (sub? super sub) +(def: .public (sub? super sub) {#.doc (doc "Is 'sub' a sub-set of 'super'?")} (All [a] (-> (Set a) (Set a) Bit)) (|> sub ..list (list.every? (..member? super)))) -(def: #export (super? sub super) +(def: .public (super? sub super) {#.doc (doc "Is 'super' a super-set of 'sub'?")} (All [a] (-> (Set a) (Set a) Bit)) (sub? super sub)) |