Ah, I see. thank you. I think I've confused two patterns. Here, we name the
function and pass the vars to wrapper. Yes, I think this answers on of my
questions.

On Mon, May 28, 2012 at 2:33 PM, Joshua Holbrook <josh.holbr...@gmail.com>wrote:

> First of all, these all look like named functions and not anonymous
> functions. The difference is that anonymous functions don't have a
> name in between the function keyword and the parens, basically. So,
> nothing special.
>
> Are you trying to do something like:
>
>    var first = function () { return 'first'; },
>        second = function () { return 'second'; };
>
>    function runFunctions (a, b) {
>      console.log(a());
>      console.log(b());
>    }
>
>    runFunctions(first, second);
>
> this ?
>
> --Josh
>
> On Mon, May 28, 2012 at 11:07 AM, Joshua Bowles <bowlesl...@gmail.com>
> 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 nodejs@googlegroups.com
> > To unsubscribe from this group, send email to
> > nodejs+unsubscr...@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/nodejs?hl=en?hl=en
>
>
>
> --
> Joshua Holbrook
> Engineer
> Nodejitsu Inc.
> j...@nodejitsu.com
>
> --
> 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 nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> 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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to