Power set: Difference between revisions
m
→Recursive: subheading change
(added Icon/Unicon example) |
m (→Recursive: subheading change) |
||
Line 767:
=={{header|Icon}} and {{header|Unicon}}==
===
The following version returns a set containing the powerset:
Line 779:
head := ?s # take a random element
# and find powerset of remaining part of set
tail_pset := power_set (
result ++:= tail_pset # add powerset of remainder to results
every ps := !tail_pset do # and add head to each powerset from the remainder
insert (result,
}
return result
|