Skip to content

Instantly share code, notes, and snippets.

@jaxspades
jaxspades / spread-macro.js
Created January 26, 2015 02:06
This sweet.js macro grants you the awesome spread operator. You can read more about it here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator. It's still in its infancy, and doesn't allow you to do all functionality, but you can flatten array literals and use the spread operator within a function call b…
// Used internally by the ..> macro
macro (..el) {
rule {
[$x:invoke(..el) (,) ...]
} => {
$x (,) ...
}
rule {
$x
} => {