Hello everyone: Suppose I have a function foo that should receive two functions as parameters. If I have two lambda functions, I can call "foo" like this:
foo (-> 1),(-> 2)
In this case, "foo" gets two functions: one that returns 1, and the other that returns 2.
However, as a rule, lambda functions are more complex, therefore both functions on the same line are not practical. Instead, I would like to write two multi-line lambda functions. However, I cannot understand for myself how to do this in coffeescript. Ideally, I would like to write it as follows, but this generates an error:
foo -> 1 , -> 2
The best I can think of is very ugly:
foo.apply [ -> 1 , -> 2 ]
Can any Coffeescript guru show how I can do this without getting an error? Thanks!
source share