Arc Forumnew | comments | leaders | submitlogin
2 points by greatness 6136 days ago | link | parent

I was thinking that _ would be merely _0, ie _1 would be the second argument. But at this point that's not really the question, the question is how will the interpreter know how many arguments the function takes?

Maybe something like:

  [[[+ _ _1 _2]]]
Could be shorthand for:

  (fn (_ _1 _2) (+ _ _1 _2))
But, then, what if you want to use square bracket notation inside of that? For example, what if you want to create a two paramater function that creates a one paramater function?

  (fn (x y) [+ x y _])
would be impossible. Unless you use currying or something on these special ones. Incidentally, a curry function:

  (def curry (f . args)
    (fn args2 (apply f (join args args2))))
Then you could simply do:

  (curry + var1 var2)
Assuming you already have the variables. For smarter currying it'll need to be done by the interpreter.