Atom - ŒP - Powerset

Characters: Π, P

Tags: miscellaneous , math , array , combinatorics

Arity: monadic

This atom is monadic, which means it takes one argument.

Functionality

Powerset (all subsets, including the empty subset, of z in increasing order of length and then lexicographical ordering).

Details

The result will be a list of size 2len(z) containing all subsets (not necessarily contiguous) of z. They are first ordered by length and then by lexicographical order, so 3R ŒP returns [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]].