2013-03-22 11:23:21 -07:00
|
|
|
fn sum(x: &[int]) -> int {
|
2013-01-22 17:20:08 -08:00
|
|
|
let mut sum = 0;
|
2013-06-22 14:43:15 -04:00
|
|
|
for x.iter().advance |y| { sum += *y; }
|
2013-01-22 17:20:08 -08:00
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2013-01-29 21:30:22 -05:00
|
|
|
fn sum_mut(y: &mut [int]) -> int {
|
2013-01-22 17:20:08 -08:00
|
|
|
sum(y)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn sum_imm(y: &[int]) -> int {
|
|
|
|
sum(y)
|
|
|
|
}
|
|
|
|
|
2013-06-22 14:43:15 -04:00
|
|
|
/* FIXME #7304
|
2013-03-22 17:58:50 -07:00
|
|
|
fn sum_const(y: &const [int]) -> int {
|
2013-01-22 17:20:08 -08:00
|
|
|
sum(y)
|
|
|
|
}
|
2013-06-22 14:43:15 -04:00
|
|
|
*/
|
2013-01-22 17:20:08 -08:00
|
|
|
|
2013-02-04 11:07:36 -08:00
|
|
|
pub fn main() {}
|