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

October 14, 2008, 08:31

A bash-only powerset could look like:

powerset_overkill() {
        local Set=$*
        if [ "${Set}" = "" ]; then
        echo ${Set}
        for i in ${Set}; do
                local Subset=${Set/${i}/}
                powerset_overkill ${Subset}

powerset() {
        powerset_overkill $* | sort | uniq

time powerset 1 2 3 4 5 6  

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

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

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