Skip to content

Instantly share code, notes, and snippets.

@bstrie
Created May 22, 2014 02:32
Show Gist options
  • Save bstrie/6dcffd79cb8cb2f62e01 to your computer and use it in GitHub Desktop.
Save bstrie/6dcffd79cb8cb2f62e01 to your computer and use it in GitHub Desktop.
#![feature(macro_rules)]
macro_rules! foo {
($head:expr, $($tail:expr),+) => ({
println!("{}", $head);
foo!($($tail),+);
});
($last:expr) => ({
println!("{}", $last);
});
}
fn main() {
foo!(1, 2, 3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment