Incongruent hash
Bruce Cohen
cohenb at gemstone.com
Tue Feb 17 18:18:52 UTC 1998
"David N. Smith" <dnsmith at watson.ibm.com> writes:
>> I've always wanted a general constructor, like {2.3.4} but which produces
>> things other than arrays. Maybe someone has done one and I haven't seen it
>> (or, as my age progresses, it's lost in the fog).
Not quite what you asked for, but I once implemented a (variable)
multi-dimensional Array class in Tek Smalltalk, with a new: method
taking an Array of SmallIntegers representing the size of the dimension
associated with that position. So MultiArray new: { 5, 5, 5 } would
create a 5X5X5 Array, and MultiArray new: { 5, 1, 5} would create a
5X1X5 Array. Similarly, there was a withValues: creator method taking
an Array (potentially of recursively nested Arrays) containing the
intial values, where nil or {} meant not to initialize that dimension.
It was fun to play with; I should see if I still have the code somewhere
(probably on an 8 inch floppy, with no drive to read it around).
-----------------------------------------------------------------------------
Engineering is never having to say you're finished.
-----------------------------------------------------------------------------
Bruce Cohen, | email: cohenb at gemstone.com
GemStone Systems, Inc. | phone: (503)533-3602
20575 NW Von Neumann Drive | fax: (503)629-8556
Beaverton, OR USA 97006 | web: http://www.gemstone.com
More information about the Squeak-dev
mailing list
|