[Newbies] Best way to implement two-dimensional array

karl karl.ramberg at comhem.se
Sun Sep 2 13:51:56 UTC 2007


Look at class Matrix

Karl


John Almberg wrote:
> Sorry... forgot one other thing... I'd like to be able to initialize 
> the table using a literal, like:
>
> #( #(1 4 3)
>    #(4 3 6)
>    #(9 5 4) )
>
> That would be a real bonus, because the table is quite large and I 
> want to be able to 'see' the table in the source code so I can change 
> it easily.
>
> -- John
>
> On Sep 2, 2007, at 8:45 AM, John Almberg wrote:
>
>> This is a smalltalk question, but hopefully not too off-topic...
>>
>> I need a lookup table object... something to which I can send a 
>> message like:
>>
>> anElement := myTable index1: #aSymbol index2: #anotherSymbol
>>
>> The underlying structure is actually a table... rows and columns... 
>> and I want to be able to fetch elements in the table.
>>
>> I am thinking myTable should hold a dictionary of dictionaries, (a 
>> hash of hashes, I might say if using another language), but I am 
>> wondering if there is a more smalltalk-ish way to do this?
>>
>> Any suggestions much appreciated.
>>
>> -- John
>>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Websites for On-line Collectible Dealers
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Identry, LLC
> John Almberg
> (631) 546-5079
> jalmberg at identry.com
> www.identry.com
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>



More information about the Beginners mailing list