Re: understanding lambda
- From: lawpoop <lawpoop@xxxxxxxxx>
- Date: Tue, 16 Jun 2009 17:16:15 -0700 (PDT)
On Jun 16, 3:52 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:
lawpoop wrote:
Trying to wrap my head around the lambda concept.
I saw this example on the php website:
$func = function($value) { return $value * 2; };
print_r(array_map($func, range(1, 5)));
Which led me to conclude this definition
"A lambda function is a function whose name is a variable, rather than
a hard-coded string."
Is this correct?
Not quite. A lambda function is one you create on the fly, as in your
first statement. The function doesn't have to be created on the fly to
be callable via a variable (your second statement).
Thanks, Jerry.
Can you give a more formal definition of "created on the fly" ?
If I write
function test_function() {
return ;
}
Why wouldn't ( or would ) that be "created on the fly"?
What are other ways you can call a function via a variable?
.
- Follow-Ups:
- Re: understanding lambda
- From: Jerry Stuckle
- Re: understanding lambda
- References:
- understanding lambda
- From: lawpoop
- Re: understanding lambda
- From: Jerry Stuckle
- understanding lambda
- Prev by Date: Re: understanding lambda
- Next by Date: Re: understanding lambda
- Previous by thread: Re: understanding lambda
- Next by thread: Re: understanding lambda
- Index(es):
Relevant Pages
|