Closed
Description
They both follow basically the same format:
fn inc_conditionally(x: uint) -> Option<uint> {
if x == uint::MAX { return None; }
else { return Some(x+1u); }
}
let v = [1u, 2, 3];
let res = collect(v.iter().map(|&x| inc_conditionally(x)));
assert!(res == Some(~[2u, 3, 4]));
These should be updated to use box
and Vec
.
Edit:
- Updated title to reflect below comment. No
box
was necessary.
Metadata
Metadata
Assignees
Labels
No labels