Learn R Programming

set6 (version 0.2.4)

powerset: Calculate a Set's Powerset

Description

Calculates and returns the powerset of a Set.

Usage

powerset(x, simplify = FALSE)

Arguments

simplify

logical, if TRUE then tries to simplify the result to a Set otherwise creates an object of class PowersetSet.

Value

Set

Details

A powerset of a set, S, is defined as the set of all subsets of S, including S itself and the empty set.

See Also

Other operators: setcomplement(), setintersect(), setpower(), setproduct(), setsymdiff(), setunion()

Examples

Run this code
# NOT RUN {
# simplify = FALSE is default
powerset(Set$new(1, 2))
powerset(Set$new(1, 2), simplify = TRUE)

# powerset of intervals
powerset(Interval$new())

# powerset of powersets
powerset(powerset(Reals$new()))
powerset(powerset(Reals$new()))$properties$cardinality
# }

Run the code above in your browser using DataLab