[#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:04258] Re: TABWTDI and Hash.new([])

From: Dave Thomas <Dave@...>
Date: 2000-07-28 17:44:10 UTC
List: ruby-talk #4258
matz@netlab.co.jp (Yukihiro Matsumoto) writes:

> I'm thinking of another way:
> 
>      Hash.new{[]}
> 
> This means if the key is not found in the hash, evaluate given block
> and returns its value as default.  In this example, the block creates
> new array for each execution.

That's far more general - I like this a lot.

In This Thread