[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Using scripting languages for KDE4 main modules
From:       Guillaume Laurent <glaurent () telegraph-road ! org>
Date:       2006-10-03 16:26:01
Message-ID: 45228F19.9090307 () telegraph-road ! org
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic