rust/src/test/run-pass/block-vec-map2.rs

11 lines
263 B
Rust
Raw Normal View History

2011-08-15 17:34:47 -05:00
use std;
2011-08-15 18:38:23 -05:00
import std::vec;
2011-08-15 17:34:47 -05:00
fn main() {
2011-08-15 18:38:23 -05:00
let v = std::vec::map2({|&i, &b| if b { -i } else { i }},
~[1, 2, 3, 4, 5],
~[true, false, false, true, true]);
2011-08-15 17:34:47 -05:00
log_err v;
assert v == ~[-1, 2, 3, -4, -5];
}