macro_rules! defmac {
(@nest $name:ident ($dol:tt) => (
[$($arg:ident)*] $($result_body:tt)+)
) => { ... };
(@nest $name:ident ($dol:tt) => (
[$($arg:ident)*] $($result_body:tt)+
)
$p1:pat $(, $p2:pat)*
) => { ... };
(@revpats [$($args:tt)*] [$($pr:pat),*]) => { ... };
(@revpats [$($args:tt)*] [$($pr:pat),*] $p1:pat $(, $p2:pat)*) => { ... };
($name:ident $($p1:pat),* => $result:expr) => { ... };
}Expand description
A macro to define lambda-like macros inline.
Syntax:
defmac!( name [ pattern [, pattern … ]] => expression )
name is the name of the new macro, followed by 0 or more patterns
separated by comma. A pattern can be just an argument name like x
or a pattern like ref value, (x, y) etc.
Supports arbitrary many arguments.