Skip to content

Instantly share code, notes, and snippets.

@tautologico
Created October 24, 2013 22:05
Show Gist options
  • Save tautologico/7145933 to your computer and use it in GitHub Desktop.
Save tautologico/7145933 to your computer and use it in GitHub Desktop.
Function to compute the length of a list in Rust.
fn length(l: @IntList) -> uint {
match *l {
Empty => 0,
Cons(_, rest) => 1 + length(rest)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment