Power set: Difference between revisions

Content added Content deleted
Line 3,410: Line 3,410:
#<Set: {#<Set: {}>, #<Set: {1}>, #<Set: {2}>, #<Set: {1, 2}>, #<Set: {3}>, #<Set: {1, 3}>, #<Set: {2, 3}>, #<Set: {1, 2, 3}>}>
#<Set: {#<Set: {}>, #<Set: {1}>, #<Set: {2}>, #<Set: {1, 2}>, #<Set: {3}>, #<Set: {1, 3}>, #<Set: {2, 3}>, #<Set: {1, 2, 3}>}>
</pre>
</pre>



=={{header|Rust}}==
=={{header|Rust}}==
Line 3,435: Line 3,436:


fn main() {
fn main() {
let set = (0..5).collect();
let set = (1..5).collect();
let set = powerset(set);
println!("{:?}", set);

let set = ["a", "b", "c", "d"].iter().collect();
let set = powerset(set);
let set = powerset(set);
println!("{:?}", set);
println!("{:?}", set);
Line 3,442: Line 3,447:


{{out}}
{{out}}
<pre>
<pre>{{}, {0}, {0, 1}, {0, 1, 2}, {0, 1, 2, 3}, {0, 1, 2, 3, 4}, {0, 1, 2, 4}, {0, 1, 3}, {0, 1, 3, 4}, {0, 1, 4}, {0, 2}, {0, 2, 3}, {0, 2, 3, 4}, {0, 2, 4}, {0, 3}, {0, 3, 4}, {0, 4}, {1}, {1, 2}, {1, 2, 3}, {1, 2, 3, 4}, {1, 2, 4}, {1, 3}, {1, 3, 4}, {1, 4}, {2}, {2, 3}, {2, 3, 4}, {2, 4}, {3}, {3, 4}, {4}}
{{}, {1}, {1, 2}, {1, 2, 3}, {1, 2, 3, 4}, {1, 2, 4}, {1, 3}, {1, 3, 4}, {1, 4}, {2}, {2, 3}, {2, 3, 4}, {2, 4}, {3}, {3, 4}, {4}}
{{}, {"a"}, {"a", "b"}, {"a", "b", "c"}, {"a", "b", "c", "d"}, {"a", "b", "d"}, {"a", "c"}, {"a", "c", "d"}, {"a", "d"}, {"b"}, {"b", "c"}, {"b", "c", "d"}, {"b", "d"}, {"c"}, {"c", "d"}, {"d"}}
</pre>
</pre>



=={{header|SAS}}==
=={{header|SAS}}==