Skip to content

Instantly share code, notes, and snippets.

@takeouchida
Created September 1, 2019 13:34
Show Gist options
  • Save takeouchida/91d4055a76b1786dc02c08d8fb606156 to your computer and use it in GitHub Desktop.
Save takeouchida/91d4055a76b1786dc02c08d8fb606156 to your computer and use it in GitHub Desktop.
A similar code to Haskell's `sequence`.
fn main() {
let v: Result<Vec<i32>, _> = "1 2 3".split(" ").map(|w| w.parse()).collect();
println!("{:?}", v); // => Ok([1, 2, 3])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment