Skip to content

Instantly share code, notes, and snippets.

@tautologico
Created October 24, 2013 22:12
Show Gist options
  • Save tautologico/7146057 to your computer and use it in GitHub Desktop.
Save tautologico/7146057 to your computer and use it in GitHub Desktop.
Function to sum all the values in a list of integers.
fn sum_list(l: @IntList) -> int {
match *l {
Empty => 0,
Cons(i, rest) => i + sum_list(rest)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment