Skip to content

Instantly share code, notes, and snippets.

@klynton
Last active December 10, 2015 07:29
Show Gist options
  • Save klynton/4401892 to your computer and use it in GitHub Desktop.
Save klynton/4401892 to your computer and use it in GitHub Desktop.
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