Std. Set
(Cure Standard Library v0.37.2)
View Source
Sets represented as maps with true values.
Every function delegates to Std.Map / Std.List, keeping the
implementation trivial and the representation directly inspectable.
A set of t is a Map(t, Bool) — the value is always true.
Examples
use Std.Set
let s = add(:x, add(:y, new()))
member(:x, s) # => true
size(s) # => 2use Std.Set
let a = from_list([1, 2, 3])
let b = from_list([2, 3, 4])
to_list(intersection(a, b)) # => [2, 3]
to_list(difference(a, b)) # => [1]