Hacker News new | ask | show | jobs
by dbpatterson 4100 days ago
You might get better optimizations if you make it tail recursive (LLVM probably gets some of these). ie:

    fn sum_tail(v : i64, l: &[i64]) -> i64 {
        match l {
            [] => v,
            [x, xs..] => sum(v + x, xs)
        }
    }