2012-05-31 16:02:39 -05:00
|
|
|
fn want_slice(v: [int]/&) -> int {
|
|
|
|
let mut sum = 0;
|
|
|
|
for vec::each(v) { |i| sum += i; }
|
|
|
|
ret sum;
|
|
|
|
}
|
|
|
|
|
2012-06-25 22:00:46 -05:00
|
|
|
fn has_mut_vec(+v: [mut int]/~) -> int {
|
2012-05-31 16:02:39 -05:00
|
|
|
want_slice(v)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2012-06-25 22:00:46 -05:00
|
|
|
assert has_mut_vec([mut 1, 2, 3]/~) == 6;
|
2012-05-31 16:02:39 -05:00
|
|
|
}
|