2018-06-22 20:57:24 +00:00
|
|
|
my @set = (1, 2, 3);
|
|
|
|
|
my @powerset = powerset(@set);
|
|
|
|
|
|
|
|
|
|
sub set_to_string {
|
|
|
|
|
"{" . join(", ", map { ref $_ ? set_to_string(@$_) : $_ } @_) . "}"
|
2015-11-18 06:14:39 +00:00
|
|
|
}
|
|
|
|
|
|
2018-06-22 20:57:24 +00:00
|
|
|
print set_to_string(@powerset), "\n";
|