fn last<'a, T>(list: &'a [T]) -> Option<&'a T> {
    match list {
        [] => None,
        [.., ref x] => Some(x)
    }
}

fn main() {
    let list: ~[char] = ~['a', 'b', 'c'];
    println!("{:?}", last(list));
    println!("{:?}", list.last()); // Cheat
}

fn last<'a, T>(list: &'a [T]) -> Option<&'a T> {
    match list {
        [] => None,
        [.., ref x] => Some(x)
    }
}

fn main() {
    let list = ~['a', 'b', 'c'];
    println!("{:?}", last(list));
    println!("{:?}", list.last()); // Cheat
}

Remove unnecessary type annotation in Problem 01
Remove unnecessary type annotation in Problem 01
