Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support var-arg splat (...) in nonterminal position #90

Closed
jbr opened this issue Dec 18, 2015 · 0 comments
Closed

support var-arg splat (...) in nonterminal position #90

jbr opened this issue Dec 18, 2015 · 0 comments

Comments

@jbr
Copy link
Owner

jbr commented Dec 18, 2015

  (def foo (a ...b c d) [ a b c d ])
var foo = function foo$(a, b, c, d) {
  var b = arguments.slice(1, -2),
    c = arguments.slice(-2)[0],
    d = arguments.slice(-1)[0];

  return [ a, b, c, d ];
};

foo(1, 2, 3, 4, 5, 6) //=> [1, [2, 3, 4], 5, 6]
@jbr jbr closed this as completed Apr 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant