From kde-core-devel Tue Oct 03 16:26:01 2006 From: Guillaume Laurent Date: Tue, 03 Oct 2006 16:26:01 +0000 To: kde-core-devel Subject: Re: Using scripting languages for KDE4 main modules Message-Id: <45228F19.9090307 () telegraph-road ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=115989281425442 Stephen Leaf wrote: > > Yes I just found that in the tutorial I'm in... > [1, 3, 5, 7, 9].find {|v| v*v > 30 } » 7 > Can anyone explain to me How that is natural to read?? > How about : array.find { |item| predicate(item) } -> returns the 1st item of the array for which 'predicate()' returns true. Really, this syntax is so pervasive in Ruby, you won't have much trouble with it very quickly. > I might agree more if I ever did a closure in perl. (might be I'm not sure > what you mean by a closure?) > Anonymous function. In Ruby, code blocks are first class objects (every done any Lisp ? the concept should be familiar). Anyway, this is getting OT. Feel free to email me if you want to carry on this discussion. -- Guillaume http://telegraph-road.org