Higher-order messaging in Ruby

Hi all.

Jus stumbled upon interesting post here:
http://legacyofthemob.se/istari/2006/10/08/higher-order-messaging-in-ruby/

One more trick allowing goodies like

[0,1,2,3,4].where.nonzero?
# => [1,2,3,4]

[0,1,2,3,4].do_collect * 2
# => [0,2,4,6,8]

And so on.
Wow, IMHO.

V.

Sorry for deluding you, but we just had this, it just got into a fierce -but
very interesting - discussion about magic.dot.notation and
magic_underscore_notation and &:_symbol? ? &:other : proc{|n| n}.call(42)
(well I am just kidding with the last one).

Cheers, Robert = Class.new( Greetings ) * 2
:wink:

···

On 10/11/06, Victor Zverok Shepelev <vshepelev@imho.com.ua> wrote:

<SNIP>

V.

--
The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man.

- George Bernhard Shaw