-
-
Save rmartinho/bb686abaf5906ab7e9fe 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
$ cat src/main.rs | |
#![feature(macro_rules)] | |
macro_rules! doe( | |
($h:expr) => ($h); | |
($h:expr; $($t:expr);+) => (bind($h, |_| { doe!($($t);*) })); | |
($v:ident <- $h:expr; $($t:expr);+) => (bind($h, |$v| { doe!($($t);+) })); | |
) | |
fn main() { | |
doe!( | |
x <- foo; | |
return(x + 2) | |
); | |
} | |
$ rustc --pretty=expanded src/main.rs | |
#![feature(macro_rules)] | |
#![feature(phase)] | |
#![no_std] | |
#![feature(globs)] | |
#[phase(plugin, link)] | |
extern crate "std" as std; | |
extern crate "native" as rt; | |
#[prelude_import] | |
use std::prelude::*; | |
fn main() { bind(foo, |x| { return (x + 2) }); } | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment