Created
September 25, 2013 14:47
-
-
Save wakandan/6700721 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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