Hmmm... I'm a bit confused. In your gist, you define lambda_good as
function lambda_good() ... // no parameters but in your Ruby code, you define it explicitly with TWO arguments. What were your intention? On Mon, May 28, 2012 at 2:37 PM, Joshua Bowles <[email protected]> wrote: > I'm clearly missing something about anonymous functions in node. As a > learning exercise I'm trying to pass multiple lambdas to a function. > I've got a gist https://gist.github.com/2820160 (and a comparison in > Ruby of what I'm trying to do https://gist.github.com/2820073). > > Thanks in advance! > > I can do this in node: > > function executeThree(someFunction, value) { > someFunction(value); > } > executeThree(function(word) {console.log(word); }, "lambda_three"); > > > I'm not able to figure out how to pass multiple anonymous functions to a > function such as this: > > function lambda_good( ) { > function executeOne(someFunction, someValue) { > someFunction(someValue); > } > > function executeTwo(anotherFunction, anotherValue){ > anotherFunction(anotherValue); > } > } > > > > I've toyed with a lot of different definitions for lambda_good but I > can't seem to get it to work. Can someone help me see what I'm missing here? > > SIDE NOTE: this is how I can do it Ruby; > > def func_one > func_one = lambda do > puts "lambda_one" > end > > #func_one.call > end > def func_two > func_two = lambda do > puts "lambda_two" > end > > #func_two.call > end > > def lambda_good(func1,func2) > func1.call > func2.call > end > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
