Module: Elixir::Set

Defined in:
lib/elixir/set.rb

Class Method Summary collapse

Class Method Details

.delete(set, value) ⇒ Object



5
6
7
# File 'lib/elixir/set.rb', line 5

def delete set, value
  set.delete value
end

.difference(set1, set2) ⇒ Object



9
10
11
# File 'lib/elixir/set.rb', line 9

def difference set1, set2
  set1.difference set2
end

.disjoint?(set1, set2) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/elixir/set.rb', line 13

def disjoint? set1, set2
  set1.disjoint? set2
end

.equal?(set1, set2) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/elixir/set.rb', line 17

def equal? set1, set2
  set1 === set2
end

.intersection(set1, set2) ⇒ Object



21
22
23
# File 'lib/elixir/set.rb', line 21

def intersection set1, set2
  set1.intersection set2
end

.member?(set, value) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/elixir/set.rb', line 25

def member? set, value
  set.member? value
end

.put(set, value) ⇒ Object



29
30
31
# File 'lib/elixir/set.rb', line 29

def put set, value
  set << value
end

.size(set) ⇒ Object



33
34
35
# File 'lib/elixir/set.rb', line 33

def size set
  set.size
end

.subset?(set1, set2) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/elixir/set.rb', line 37

def subset? set1, set2
  set1.subset? set2
end

.to_list(set) ⇒ Object



41
42
43
# File 'lib/elixir/set.rb', line 41

def to_list set
  set.to_a
end

.union(set1, set2) ⇒ Object



45
46
47
# File 'lib/elixir/set.rb', line 45

def union set1, set2
  set1.union set2
end