Skip to content

Instantly share code, notes, and snippets.

@wakandan
Created September 25, 2013 14:47
Show Gist options
  • Save wakandan/6700721 to your computer and use it in GitHub Desktop.
Save wakandan/6700721 to your computer and use it in GitHub Desktop.
fn rv(head: Option<~Node>) -> Option<~Node>{
let mut return_head = None;
let mut current_head = head;
loop {
match current_head.take() {
Some(node) => {
let mut node = node; //make the node usable
current_head = node.next.take();
node.next = return_head;
return_head = Some(node);
},
None => {
break;
}
}
}
return_head
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment