[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Multi-dimensioned sparse array ?

Austin Ziegler

11/19/2003 8:36:00 PM

On Thu, 20 Nov 2003 02:42:16 +0900, Robert Klemme wrote:
> "Austin Ziegler" <austin@halostatue.ca> schrieb im Newsbeitrag
>> On Wed, 19 Nov 2003 14:21:19 +0900, Charles Hixson wrote:
>>> Does anyone have an implementation of a multi-dimensioned sparse
>>> array?
>> What about using hashes?
[...]
>> msa = Hash.new { |h, k| h[k] = Hash.new }
>> hash_maker = proc { |h, k| h[k] = Hash.new(&hash_maker) }
>> msa = Hash.new(&hash_maker)
> Another option: use a single Hash, *no* hash nesting and arrays as
> keys:

I believe that Mr Hixson requires slices. This wouldn't be possible
with array-keys.

-austin
--
austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.11.19
* 15.34.36