Last active
December 10, 2015 07:29
-
-
Save klynton/4401892 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
Rust as it is now: | |
use core::*; | |
fn main() { | |
for ["Alice", "Bob", "Carol"].each |&name| { | |
do task::spawn { | |
let v = rand::Rng().shuffle([1, 2, 3]); | |
for v.each |&num| { | |
io::print(fmt!("%s says: '%d'\n", name, num)) | |
} | |
} | |
} | |
} | |
New syntax, NO SHIFTS: | |
use core//---; | |
fn main/\ [ | |
for ['Alice', 'Bob', 'Carol'].each \,,name\ [ | |
do task//spawn [ | |
let v = rand//Rng/\.shuffle/[1, 2, 3]\; | |
for v.each \,,num\ [ | |
io//print[fmt1[',.s says: ',.d'\\n', name, num]] | |
] | |
] | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment