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

Curry named functions #751

kkirby opened this issue Jul 9, 2015 · 4 comments

Curry named functions #751

kkirby opened this issue Jul 9, 2015 · 4 comments


Copy link

@kkirby kkirby commented Jul 9, 2015

If you have a named function that curries (I think that's how you'd name it?), the function isn't scoped properly.

:abc (x,y) --> x + y


var abc;
abc = (curry$(function(x, y){
  return x + y;


(curry$(function abc(x, y){
  return x + y;
Copy link

@vendethiel vendethiel commented Jul 9, 2015

it's mostly because "labels" attach to "blocks", nothing else. (a for, a function, etc). You ought to use a = --> or

~function a(b, c)

for curried functions anyway ;-).

Copy link

@kkirby kkirby commented Jul 9, 2015

I agree to use a = -->, but is this considered expected functionality? I was just reading the code and saw that you can name a function using the label syntax and saw that currying doesn't work with this. If this is expected, should the parser maybe throw an error when this is occurred?

@vendethiel vendethiel added the bug label Jul 9, 2015
Copy link

@waynedpj waynedpj commented Sep 18, 2015

also having an issue with creating a curried named function as suggested above ala

~function named (a, b)
  a + b

which compiles to a bound named function w/ 1.4.0 as expected

var this$ = this;
function named(a, b){
  return a + b;

all the other combinations i have tried (e.g. --function named, -function named) are giving compilation errors or not currying the named function.

perhaps it is not possible to create a curried named function as they are constants?


Copy link

@igl igl commented Sep 19, 2015

The problem is that you can't.
Wrapping a function statement in Javascript will make it a function expression.
Same as:

foo = :foo -->

The only fix i can think of would be to wrap the body of the function and not the declaration.

misterfish added a commit to misterfish/LiveScript that referenced this issue Jun 4, 2016
@misterfish misterfish mentioned this issue Jun 4, 2016
@gkz gkz closed this in #894 Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants