You're viewing a comment by Andreas and its responses.

October 14, 2008, 09:04

For the power set, you could use shell functions, e.g.

p() { [ $# -eq 0 ] && echo || (shift; p "$@") | while read r ; do echo -e "$1 $r\n$r"; done }

Then,

p `cat set`

outputs the power set, e.g.

$ p 1 2 3
1 2 3
2 3
1 3
3
1 2
2
1 

Of course, this is limited to max_args of bash, but who needs the power set of >500 elements anyway? ;-)

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "disk": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.