No, but this comes close:

{'key1'->'value1'. 'key2'->'value2'} as: Dictionary.

- Bert -

On Sep 2, 2007, at 12:00 , John Almberg wrote:

H'mmm... *is* there a way to create a dictionary literal? I can't seem to find an example....

-- John


On Sep 2, 2007, at 9:00 AM, 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
[email protected]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to