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-01 02:16:42 -05:00
|
|
|
foreach 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-06-22 13:43:15 -05:00
|
|
|
/* FIXME #7304
|
2013-03-22 19:58:50 -05:00
|
|
|
fn sum_const(y: &const [int]) -> int {
|
2013-01-22 19:20:08 -06:00
|
|
|
sum(y)
|
|
|
|
}
|
2013-06-22 13:43:15 -05:00
|
|
|
*/
|
2013-01-22 19:20:08 -06:00
|
|
|
|
2013-02-04 13:07:36 -06:00
|
|
|
pub fn main() {}
|