var set : java.util.Set<String> = {"a", "b", "c"}
print( set.powerSet() )
prints [[], [b], [c], [b, c, a], [a], [b, c], [a, c], [b, a]]
You can try it here (until the Heroku dyno goes down): http://gosu-lang.github.io/play.html powerset = filterM (const [True, False])
Which when ran will return: >>> powerset [1,2,3,4]
[[1,2,3,4],[1,2,3],[1,2,4],[1,2],[1,3,4],[1,3],[1,4],[1],[2,3,4],[2,3],[2,4],[2],[3,4],[3],[4],[]]