We can compute power sets in Disco using the power function:
Disco> power({1,2,3})
{{}, {1}, {1, 2}, {1, 2, 3}, {1, 3}, {2}, {2, 3}, {3}}
Disco> power({})
{{}}
Disco> power({2..5})
{{}, {2}, {2, 3}, {2, 3, 4}, {2, 3, 4, 5}, {2, 3, 5}, {2, 4}, {2, 4, 5}, {2, 5}, {3}, {3, 4}, {3, 4, 5}, {3, 5}, {4}, {4, 5}, {5}}
Disco> { |power({1..n})| | n in {1 .. 8} }
{2, 4, 8, 16, 32, 64, 128, 256}When given a set of type Set(T), the power function produces a result of type Set(Set(T)); that is, given a set of T, it produces a set of sets of T.
Disco> :type {1,2,3}
{1, 2, 3} : Set(ℕ)
Disco> :type power({1,2,3})
power({1, 2, 3}) : Set(Set(ℕ))