difference between Sequenceable and Ordered

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

difference between Sequenceable and Ordered

Tristan Bourgois
Does anybody can explain the difference between a Sequenceable Collection and an Ordered Collection?

Thanks.

Tristan Bourgois.
Reply | Threaded
Open this post in threaded view
|

Re: difference between Sequenceable and Ordered

Schwab,Wilhelm K
Tristan,

SequenceableCollection abstracts using integers to index a collection; from there, subclasses (OrderedCollection is one of them) specialize the behavior to create growable and non-growable collections, collections specific to certain types of objects, etc.  The Squeak/Pharo hierarchy browsers are **terrible** which greatly complicates building an understanding of such things.  If you use or have access to Windows, you might grab the Community Edition of Dolphin Smalltalk if only to use their class hierarchy browser to look around the collections hierarchy.  Dolphin has the best IDE in the business.

Another question you might be asking is which collection class to use?  The workhorses include Dictionary, Bag, SortedCollection, OrderedCollection, and sometimes Array; String and ByteArray count too, though they and things like FloatArray hold only specific types of objects for speed, gc efficiency, external calls, etc..  For reasons completely inscrutable to me after more than 15 years of Smalltalk use, streams like to work with and grow an Array far more than an OrderedCollection.  Some things are best tolerate than understood :)

Does that help?

Bill




________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Tristan Bourgois [[hidden email]]
Sent: Wednesday, May 26, 2010 10:19 AM
To: [hidden email]
Subject: [Pharo-project] difference between Sequenceable and Ordered

Does anybody can explain the difference between a Sequenceable Collection and
an Ordered Collection?

Thanks.

Tristan Bourgois.
--
View this message in context: http://forum.world.st/difference-between-Sequenceable-and-Ordered-tp2231718p2231718.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: difference between Sequenceable and Ordered

Tristan Bourgois
Thanks, that's very interesting but not really help me sorry!
Sorry may be the question are not very precise.
My question is about the behavior so I put it in the context:

I refactoring the collection in trait and I search if
there are a difference between a Sequenceable and
Ordered behavior. Because if there are not difference
I don't create trait for the Ordered behavior.

So do you think there are difference between the two behavior?
Reply | Threaded
Open this post in threaded view
|

Re: difference between Sequenceable and Ordered

Nicolas Cellier
Ordered have the capability of adding/removing elements, Sequenceable
not necessarily (think of Arrayed)

Nicolas

2010/5/27 Tristan Bourgois <[hidden email]>:

>
> Thanks, that's very interesting but not really help me sorry!
> Sorry may be the question are not very precise.
> My question is about the behavior so I put it in the context:
>
> I refactoring the collection in trait and I search if
> there are a difference between a Sequenceable and
> Ordered behavior. Because if there are not difference
> I don't create trait for the Ordered behavior.
>
> So do you think there are difference between the two behavior?
>
> --
> View this message in context: http://forum.world.st/difference-between-Sequenceable-and-Ordered-tp2231718p2232820.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: difference between Sequenceable and Ordered

Julian Fitzell-2
In reply to this post by Tristan Bourgois
Take a look at the ANSI standard - it has the collection behaviour
already broken up into "traits" that are multiply-inherited to define
the protocols of each class.

Julian

On Thu, May 27, 2010 at 10:32 AM, Tristan Bourgois
<[hidden email]> wrote:

>
> Thanks, that's very interesting but not really help me sorry!
> Sorry may be the question are not very precise.
> My question is about the behavior so I put it in the context:
>
> I refactoring the collection in trait and I search if
> there are a difference between a Sequenceable and
> Ordered behavior. Because if there are not difference
> I don't create trait for the Ordered behavior.
>
> So do you think there are difference between the two behavior?
>
> --
> View this message in context: http://forum.world.st/difference-between-Sequenceable-and-Ordered-tp2231718p2232820.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: difference between Sequenceable and Ordered

Tristan Bourgois
Hi,

I took a look on the ANSI standard. I base my work on
the paper of Wiliam R. Cook "Interfaces and Specifications
 for the Smalltalk- Collection Classes"
http://carlstrom.com/stanford/cs242/readings/12.pdf
I prefer this paper because dictionary is not a protocol
a single protocol. It takes the behavior of Indexed and
I think that's logical. But ANSI standard is very interesting
and we could use the 2!

I think Nicolas is right about the 2 differences. I think
I blocked on the literal sense of Sequenceable and Ordered.

Tristan.