# NOT RUN {
# Set of positives
s = ConditionalSet$new(function(x) x > 0)
s$contains(list(1,-1))
# Set via equality
s = ConditionalSet$new(function(x, y) x + y == 2)
s$contains(list(Set$new(2, 0), Set$new(0, 2)))
# Tuples are recommended when using contains as they allow non-unique elements
s = ConditionalSet$new(function(x, y) x + y == 4)
# }
# NOT RUN {
s$contains(Set$new(2, 2)) # Errors as Set$new(2,2) == Set$new(2)
# }
# NOT RUN {
s$contains(Tuple$new(2, 2))
# Set of Positive Naturals
s = ConditionalSet$new(function(x) TRUE, argclass = list(x = PosNaturals$new()))
s$contains(list(-2, 2))
# }
Run the code above in your browser using DataLab