Using scripting languages for KDE4 main modules

Guillaume Laurent glaurent at telegraph-road.org
Tue Oct 3 17:26:01 BST 2006


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





More information about the kde-core-devel mailing list