anko / eslisp-fancy-function

eslisp macro: function expression with argument-splats and implicit return
0 stars 1 forks source link

eslisp-fancy-function

An eslisp macro that works like an the usual lambda expression macro but also

Note that despite the name, this module is strictly a function expressions (lambda-ish) macro, not a function declaration. I'll rearrange that eventually.

Example

(macro fun (require "eslisp-fancy-function"))
(fun (a b ...c d) (* a b d))

(function (a, b) {
    var c = Array.prototype.slice.call(arguments, 2, -1);
    var d = arguments[arguments.length - 1];
    return a * (b * d);
});

See the tests for fuller usage.

License

ISC.