Last active
December 20, 2015 08:29
-
-
Save jmgrosen/6100505 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
use std::os; | |
fn tokenize(raw: &str) -> ~[&str] { | |
let replaced: ~str = raw.replace("(", " ( ").replace(")", " ) "); | |
replaced.split_iter(' ').collect() | |
} | |
fn main() { | |
printfln!("%?", tokenize(os::args()[1])); | |
} |
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
use std::os; | |
fn tokenize(raw: &str) -> ~[~str] { | |
let replaced: ~str = raw.replace("(", " ( ").replace(")", " ) "); | |
replaced.split_iter(' ').transform(|token| token.to_owned()).collect() | |
} | |
fn main() { | |
printfln!("%?", tokenize(os::args()[1])); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment