From: Arved Sandstrom Date: 2008-04-18T10:20:13+09:00 Subject: Re: When are lambdas needed? "Stedwick" wrote in message news:9568e4ae-6c60-4d8f-b460-7d9f414bcee9@l42g2000hsc.googlegroups.com... >I have seen many tutorials on the Internet explaining where lambdas > CAN be used, such as clever multiplication functions, but when are > they actually NEEDED? > > Sure, I can take a lambda and "pass it around" so to speak, but I can > call a function from anywhere too, right? > > Can somebody give me an extremely useful, NOT complicated, example of > when lambdas are the absolute perfect solution to a problem? > > Thanks! One main use is precisely when you don't need to pass anything around - you need a one-off function, and probably the function isn't particularly complicated. Typical examples are when supplying a code block to a sort, group, map or filter function. Are they needed? No. But then again, neither are subroutines or modules or for loops... AHS