struct Set(T)

Overview

Set implements a collection of unordered values with no duplicates.

An Enumerable object can be converted to Set using the #to_set method.

Set uses Hash as storage, so you must note the following points:

Example

s1 = Set{1, 2}
s2 = [1, 2].to_set
s3 = Set.new [1, 2]
s1 == s2 # => true
s1 == s3 # => true
s1.add(2)
s1.concat([6, 8])
s1.subset_of? s2 # => false
s2.subset_of? s1 # => true

Included Modules

Defined in:

py2cr/set.cr

Instance Method Summary

Instance methods inherited from module Enumerable(T)

py_all? py_all?, py_any? py_any?, py_each(&block : T -> _) py_each

Instance Method Detail

def py_in?(element) #

[View source]
def remove(x) #

[View source]