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

From: Aleksi Niemel<aleksi.niemela@...>
Date: 2000-07-28 17:39:18 UTC
List: ruby-talk #4257
Matz:
> 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.

Sounds even better (more powerful) as one can easily have logic for
determination of what should be the default value this time.

	- Aleksi

In This Thread

Prev Next