Skip to content

Instantly share code, notes, and snippets.

@vendethiel
Created December 21, 2015 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vendethiel/cdc4167f6492f2f62bf2 to your computer and use it in GitHub Desktop.
Save vendethiel/cdc4167f6492f2f62bf2 to your computer and use it in GitHub Desktop.
use 007; # no missing _
macro gen-gen(names) {
my macros = names.each(-> name {
my id = Q::Identifier.new('gen-'~name); #
return quasi {
macro {{{id}}}(operators) {
my operators = operators.map(-> category, operator) {
sub {{{ {{{ name }}} }}}:{{{ operator @ Q::Literal::Str }}} {
};
};
return operators; # XXX do we need to wrap this because it's an array?
};
};
});
return macros; # XXX do we need to wrap this because it's an array?
};
gen-gen(['infix']);
gen-infix({add: '+'});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment