2012-06-29 18:26:56 -05:00
|
|
|
fn want_slice(v: &[int]) -> int {
|
2012-05-31 16:02:39 -05:00
|
|
|
let mut sum = 0;
|
2012-06-30 18:19:07 -05:00
|
|
|
for vec::each(v) |i| { sum += i; }
|
2012-05-31 16:02:39 -05:00
|
|
|
ret sum;
|
|
|
|
}
|
|
|
|
|
2012-06-29 18:26:56 -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-29 18:26:56 -05:00
|
|
|
assert has_mut_vec(~[mut 1, 2, 3]) == 6;
|
2012-05-31 16:02:39 -05:00
|
|
|
}
|