[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04091] 'each' and 'in'

From: hal9000@...
Date: 2000-07-17 18:14:33 UTC
List: ruby-talk #4091
I just recently realized why the default
iterator is called "each"... t.e., why
there is a default name at all.

As an exercise, I'm building a little set
module that will expand on the set manipulation
features that arrays have. (I'm not inheriting
from Array, though perhaps I should. I'll let
people critique it soon.)

I thought to myself, "Wouldn't it be nice if I
could do something like 'for x in s' as I can
for arrays?" Idly I tried it... and it worked!

For an instant I thought Ruby was reading my mind...
if Matz can do that, it IS a powerful language!

But then I realized that it was calling my 'each'
iterator that I had defined. And in order for this
kind of thing to be possible, the iterator has to
have a well-known name.

I love this language...

Hal

--
Hal Fulton


Sent via Deja.com http://www.deja.com/
Before you buy.

In This Thread

Prev Next