Skip to content

Instantly share code, notes, and snippets.

View dominicparga's full-sized avatar
👾
nerding around

Parga Cacheiro, Dominic dominicparga

👾
nerding around
View GitHub Profile
@dominicparga
dominicparga / power_set.rs
Last active July 31, 2020 12:46
Computing a power-set from a boolean vector
fn main() {
// in the end, print all combinations from this vector ([0, 1, 0, 1, 1, 0]),
// only considering entries != 0
// resulting in
// [0, 1, 0, 0, 0, 0],
// [0, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0],
// [0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 1, 0], [0, 1, 0, 1, 1, 0]
let v = vec![false, true, false, true, true, false];
// v