Tutorials, not sure. But I can give you examples from stuff I have running.
The basic thing to know about lambdas is that they are (in most languages that support them), no different than normal functions.
Taking javascript for example,
function my_alert(txt)
{
alert("my alert: " + txt);
}Is no different than
var my_alert = function(txt)
{
alert("my alert: " + txt);
}In most cases (in my experience), lambdas are "throwaway" functions - they'll be called once, or only within a certain scope.
A common example for this is something like a call to "map", which just applies a function to all members of an array or list, and returns the new list (rather than changing the existing list).
php has an array_map function, which is now made even better with lambdas.
Say you wanted to determine which elements of an array had integer square roots and return a list containing the integer square roots, or -1 if it's a non-integer square root (just for the sake of example).
You would normally (using the array_map function) do something like this:
$arr = Array(2,4,6,8,9,12,16);
function only_int_sqrt($v)
{
$sqrtval = sqrt($v);
return is_int($sqrtval) ? $sqrtval : -1;
}
$newarr = array_map(only_int_sqrt,$arr);But, with lambdas, you could make it a little more succint:
$arr = Array(2,4,6,8,9,12,16);
$newarr = array_map(function($v){$s = sqrt($v); return is_int($s) ? $s : -1;},$newarr);
I recognize that that isn't TERRIBLY readable or obvious, but it's an example of somewhere that someone might use a lambda, assuming that's hte only spot in the code someone would want to apply that kind of filter.
I gotta leave for volleyball in a few minutes, so I tried squeezing in a pretty brief summary, but it looks like I'm going to run out of time.
The last part about lambdas (and one of the most useful) is about closures.
Closures are lambda expressions that have access to variables for which it shares scope, even if the scope has itself gone out of scope (or something like that).
Big example that I use most frequently: AJAX implementations and AJAX callbacks.
This is the ajax implementation that I use on this site. For practical purposes, you can ignore the "engineresponse" call part.
The general usage is like this
engine(callback_function,URL,[optional form contents of a post operation]);
It'll then send the request to the URL, and fun callback_function on the text of the response.

The thing to note though is this:
x.onreadystatechange = function() { if(x.readyState==4) ... };
The function still has access to variables outside of it's scope (the x variable). This means that the context of the function when it's called is kept along with the function itself.
As perhaps a more obvious example, I frequently make AJAX calls that I need to retain some state information when the browser receieves the response, and for that I'll do a small closure.
Say I wanted to retrieve the text of a single post via AJAX (say doing an inline edit or something) and post the results back into a div with id "post12345" where 12345 is the postid from the database, using the above function I'd do it like this:
//note: dge() is an alias I use for document.getElementById;
function retrieve_new_post(postid)
{
engine(function(resp){dge("post" + postid).innerHTML = resp},"getpost.php?postid=" + postid);
}What makes that neat is that the function(resp) has access to the postid even AFTER the retrieve_new_post function finishes and goes out of scope. The engine() call returns immediately (it doesn't wait for the ajax call to complete), and then the function goes out of scope. But once the browser receives the response from the request, the closure gets called, and places the response text in the right div (getting the postid from it's context).
Before I understood closures, I do similar to above, but instead, I would include the postid in the response text then parse out the postid from the response. This way requires much less coding, is faster (though trivially so, I guess), and is more straightforware. Using a closure takes care of all of that, replacing the parsing step.
Am I making any sense? I just woke up like 30 minutes ago and I'm rushing because I have to leave for volleyball like right now.
----
Do it for the Lobster