Folks,
Short story: ------------ 1. Array2D must go. 2. Matrix must be a SequenceableCollection 3. We need a new subclass of SequenceableCollection: SubSequenceableCollection.
Long story: ----------- I have been following the following the demise of Array2D and the birth of Matrix with glee as I need a decent table functionality.
A major problem with Array2D, as pointed dout on this list, is that any matrix thing is not two dimensional - only the subscript space is. Further, the name and the interface stink. It should go away.
I have also been fiddling with Magma. It comes to pass that Magma doesn't like to play with Matrix.
On further investigation, Magma was absolved of all guilt - I can make my own Matrix class which works perfectly.
But, the present implementation of Matrix is also flawed in that a matrix IS sequential - after all row major is an ordering. This is why is has to lie in #isSequenceable.
However it is not implemented as a subclass of SequenceableCollection becuase it would then inherit a truck load of methods to do with copying sub-ranges: e.g. #copyFrom:to: and friends.
It also has to reimplement a bucket load of methods to pretend it is sequenceable.
IMHO the situation should be:
Object Collection SequenceableCollection Matrix SubSequenceableCollection NB!!!!! ArrayedCollection Array OrderedCollection ...etc...
Then if the offending methods are moved down to SubSequenceableCollection, all is well.
Regrettably, one cannot change the hierarchy of the collection classes - too dangerous apparently. I suspect something to do with the special objects array.
If anyone knows how to do this, let me know and I will test it.
I am awarding myself a beer in advance.
Cheers
Brent
__________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
On Wed, 4 Dec 2002, Brent Pinkney wrote:
Folks,
Short story:
- Array2D must go.
- Matrix must be a SequenceableCollection
- We need a new subclass of SequenceableCollection:
SubSequenceableCollection.
I don't have suggestions about the implementation, but I do recommend using the name "Sequence" instead of "SubSequenceableCollection" since the latter denotes some kind of slice (as in "SubSequence").
On Wednesday 04 December 2002 09:40 pm, Brian T Rice wrote:
I don't have suggestions about the implementation, but I do recommend using the name "Sequence" instead of "SubSequenceableCollection" since the latter denotes some kind of slice (as in "SubSequence").
Why not just have a message that returns a row/column as a normal sequencable collection of your choice?
Why the need for a super fancy sub-sub-sub sequencable collection? ( what happens when start considering 3D matrices, or 4d? <:) )
Just ask the Matrix how you want it sliced/diced?
Take this with a grain of salt, but...
Matrix row:3 would return the 3rd row of the matrix, etc, etc
Also, matrices and arrays are two different beasts. Sure, a matrice's data can be stored as a 2d array, but one is a handy storage format, and the other has all sorts of mathematical cruft.
Also, If we've gone to matrix, and throw away the lightweight 2D array, well, what happens when you ask Matrix to multiply itself by a 1D array? ( Array is a degenerate case of Matrix now, should it not be removed too? ).
What's needed is a general array class, that can construct a variety of n-dimensional arrays, and a PIE like system that allows one to graft on the math aspects/traits as needed... ;)
Nevermind the whole point with numbers being used to run loops....
Why do numbers need to know about looping? Is there some other way than
1 to: 3 do: [ ]
We got numbers acting like loop constructs, and now arrays acting like mathematical objects.... Besides, building a 2D array is already easy, it's just a collection of collections.
I don't think any of this makes sense from a well factored standpoint. Too many things doing what they shouldn't.
-Daniel
No, You got it both wrong ;) Should've looked at the long story. SubSEquenceableCollection really is a good name _because_ it denotes slices (sliceability). It is really used to factor the slicing out of SequencebleCollection. In this light it becomes clear that you will never need a subsubsub...SQ.
Rgards, Torge
Am 05.12.2002 08:20:14 schrieb Daniel Joyce daniel.a.joyce@worldnet.att.net:
On Wednesday 04 December 2002 09:40 pm, Brian T Rice wrote:
I don't have suggestions about the implementation, but I do recommend using the name "Sequence" instead of "SubSequenceableCollection" since the latter denotes some kind of slice (as in "SubSequence").
Why not just have a message that returns a row/column as a normal sequencable collection of your choice?
Why the need for a super fancy sub-sub-sub sequencable collection? ( what happens when start considering 3D matrices, or 4d? <:) )
Just ask the Matrix how you want it sliced/diced?
Take this with a grain of salt, but...
Matrix row:3 would return the 3rd row of the matrix, etc, etc
Also, matrices and arrays are two different beasts. Sure, a matrice's data can be stored as a 2d array, but one is a handy storage format, and the other has all sorts of mathematical cruft.
Also, If we've gone to matrix, and throw away the lightweight 2D array, well, what happens when you ask Matrix to multiply itself by a 1D array? ( Array is a degenerate case of Matrix now, should it not be removed too? ).
What's needed is a general array class, that can construct a variety of n-dimensional arrays, and a PIE like system that allows one to graft on the math aspects/traits as needed... ;)
Nevermind the whole point with numbers being used to run loops....
Why do numbers need to know about looping? Is there some other way than
1 to: 3 do: [ ]
We got numbers acting like loop constructs, and now arrays acting like mathematical objects.... Besides, building a 2D array is already easy, it's just a collection of collections.
I don't think any of this makes sense from a well factored standpoint. Too many things doing what they shouldn't.
-Daniel
On Thu, 5 Dec 2002, Torge.Husfeldt wrote:
No, You got it both wrong ;) Should've looked at the long story. SubSEquenceableCollection really is a good name _because_ it denotes slices (sliceability). It is really used to factor the slicing out of SequencebleCollection. In this light it becomes clear that you will never need a subsubsub...SQ.
Rgards, Torge
I mentioned "SubSequence" because Slate implements those and renames SequenceableCollection to Sequence. What I was suggesting was that SequenceableCollection includes (sub-)sliceability or linearization capability, and that SubSequence be the slices themselves.
I mentioned "SubSequence" because Slate implements those and renames SequenceableCollection to Sequence. What I was suggesting was that SequenceableCollection includes (sub-)sliceability or linearization capability, and that SubSequence be the slices themselves.
And again, I ask, how are those 'slices' any different than a sequencable collection anyways?
NB, any array can be stored as a linear 1D array with the appropiate choice of computing addresses/offsets into it.... ( nevermind storing binary trees as arrays w/o using pointers in C )
I still DON'T see the need?
A Collection of Collections is a 2D array, that can return a collection as a slice. One can slice and dice any way you want ( with the necessary code of course )...
Why add extra complexity where none is needed?
-Daniel
On Mon, 9 Dec 2002, Daniel Joyce wrote:
I mentioned "SubSequence" because Slate implements those and renames SequenceableCollection to Sequence. What I was suggesting was that SequenceableCollection includes (sub-)sliceability or linearization capability, and that SubSequence be the slices themselves.
And again, I ask, how are those 'slices' any different than a sequencable collection anyways?
Because they aren't independent slices, they're objects which acts as independent sequences by Delegating To an existing sequence and storing the indices between which the slice takes its elements. If I wanted independent slices, I'd just use methods in the sequence protocol which already exist.
NB, any array can be stored as a linear 1D array with the appropiate choice of computing addresses/offsets into it.... ( nevermind storing binary trees as arrays w/o using pointers in C )
I still DON'T see the need?
Because N-dimensional arrays are NOT Sequences, only SequenceABLE, while the other simply is a sequence... why am I the only person who thinks classes should have some kind of concept behind them? Sorry, that's unfair, but I could make the same case for directed acyclic graphs: that since there's an externally-knowable sequentialization of them, that this qualifies me to make them a subclass of Sequence.
The alternative here is to NOT make everything with a knowable linear ordering a Sequence, but a SequenceableCollection, and make subclasses of Sequence for the _different_ _kinds_ of orderings that can be imposed, which would amount to a View on the original. Of course you're going to react badly to that suggestion, so there's really no point in my bringing it up.
A Collection of Collections is a 2D array, that can return a collection as a slice. One can slice and dice any way you want ( with the necessary code of course )...
Why add extra complexity where none is needed?
A collection of collections is NOT a 2D array, it merely takes on some of the properties. The only reason you could be excused for saying that does not exist in Smalltalk: a generic, parametrizable type sytem. Also, sometimes you want a different view of a same collection, which copying-slices or just straight copying will not give you.
-Daniel
You can argue that collections themselves aren't needed, that we should only use arrays, and just stuff all the useful operators onto those: after all, isn't a Set an Array in Smalltalk? It's all just the same thing! :)
squeak-dev@lists.squeakfoundation.org