# Higher-order messaging in Ruby

**URL:** <https://www.ruby-forum.com/t/higher-order-messaging-in-ruby/71830>\
**Category:** Ruby\
**Created:** [October 11, 2006, 7:38pm UTC](https://www.ruby-forum.com/t/higher-order-messaging-in-ruby/71830 "2006-10-11T19:38:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/u/Victor_SZverokSS_Sh)\
**Post date:** [October 11, 2006, 7:38pm UTC](https://www.ruby-forum.com/t/higher-order-messaging-in-ruby/71830/1 "2006-10-11T19:38:05Z")

</div>

Hi all.

Jus stumbled upon interesting post here:  
[http://legacyofthemob.se/istari/2006/10/08/higher-order-messaging-in-ruby/](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.

---

<div class="post-metadata">

**Author:** ![Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@Victor\_SZverokSS\_Sh](https://www.ruby-forum.com/u/Victor_SZverokSS_Sh)\
**Post date:** [October 11, 2006, 10:02pm UTC](https://www.ruby-forum.com/t/higher-order-messaging-in-ruby/71830/2 "2006-10-11T22:02:13Z")

</div>

On 10/11/06, Victor Zverok S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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  
😉

–  
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
