2013-03-22 13:23:21 -05:00
|
|
|
fn sum(x: &[int]) -> int {
|
2013-01-22 19:20:08 -06:00
|
|
|
let mut sum = 0;
|
2013-08-03 11:45:23 -05:00
|
|
|
for y in x.iter() { sum += *y; }
|
2013-01-22 19:20:08 -06:00
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2013-01-29 20:30:22 -06:00
|
|
|
fn sum_mut(y: &mut [int]) -> int {
|
2013-01-22 19:20:08 -06:00
|
|
|
sum(y)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn sum_imm(y: &[int]) -> int {
|
|
|
|
sum(y)
|
|
|
|
}
|
|
|
|
|
2013-02-04 13:07:36 -06:00
|
|
|
pub fn main() {}
|