On Apr 17, 2008, at 3:35 PM, Stedwick wrote: > Can somebody give me an extremely useful, NOT complicated, example of > when lambdas are the absolute perfect solution to a problem? cache :index, :ttl => 42, :key => lambda{ request['important'] } this is a class level method which says "cache the index method, invalidating every 42 seconds, by using the current request's 'important' value from the query" note that in this cast the lambda will be instance_eval'd - so when we say 'request' here it will ultimately mean the current request another example: def each &block @list.each &block end here we need to have captured the calling block's scope in other to relay it along to our internal @list object's each method. it's NOT the case that we want the scope if the function for this lambda, what we want is logic bound to the scope of the caller lambda are perfect anytime you want a context sensitive result and don't want to code everything in one massive global scope. a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama