Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including eslisp-fancy-function with all npm packages installed. Try it out:

require("eslisp/package.json"); // eslisp is a peer dependency. var eslispFancyFunction = require("eslisp-fancy-function")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

eslisp-fancy-function v0.2.0

eslisp function macro with rest arguments and implicit return


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

  • parses splats (atoms starting with ...) in the arguments and turns them into appropriate variable assignments prepended to the function body, and
  • implicitly returns the last thing in the body if it's an expression.

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


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

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

See the tests for fuller usage.




RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free