
I've been arguing that sequences should be treated differently from other data structures, since they can be handled by a Haskell 98 class, and they exhibit greater variety, so the class is more useful. One way to get there is to take Edison, remove the module-based overloading and add default definitions to the class. I don't think default definitions are quite as useless as Chris suggests: often there is a most common default; in some other cases there is a choice, but you have a family of methods that will all decide the same way, so you can delegate to one member of the family. And defaults make it easier to get started with a new instance. To have something concrete to discuss, I've placed a structure based on Edison at docs: http://www.soi.city.ac.uk/~ross/seq/ code: http://www.soi.city.ac.uk/~ross/seq.tar.gz

G'day all. Quoting ross@soi.city.ac.uk:
I don't think default definitions are quite as useless as Chris suggests: often there is a most common default; in some other cases there is a choice, but you have a family of methods that will all decide the same way, so you can delegate to one member of the family.
Well spotted! (Disclaimer: Mention of STL follows. Potential Godwin's Law issues, so proceed with caution.) One thing which isn't often appreciated about the STL is that they key thing which everything rests on is the iterator category. The details are unimportant, but the whole thing rests on what operations a specific iterator supports. The key features are: - Can the iterator be read from? - Can the iterator be written to? - Can you move it forwards (implies that it can be read from)? - Can you move it backwards (implies that you can move it forwards)? - Can you jump randomly (implies that it can be moved backwards)? The key point is that choosing which algorithm is the most efficient for some container can be determined from the iterator categories alone. In principle, it shouldn't be too hard to identify families of sequences/associations/collections all of which support a certain efficient default, and to associate the family with the collection. Cheers, Andrew Bromage

On Mon, 5 Apr 2004 ajb@spamcop.net wrote:
In principle, it shouldn't be too hard to identify families of sequences/associations/collections all of which support a certain efficient default, and to associate the family with the collection.
Been there, done that. Dessy distinguishes for Sequences: queues and democratic and for Ordered Structures: Search Trees, Range Trees, Tries http://www.stud.tu-ilmenau.de/~robertw/dessy/fun/#impl To implement this using default members we need a language extension which is roughly specified on that page. Formal proposal follows. Robert

Ross, The Abstract Sequences of my proposal are really not so much different from yours, with the advantag that I already have 5 (five) implementations and the approach scales to Ordered Collections (which could be standardised later). I strongly suggest we make up a common proposal, I'll write you with details when I've finished my Master's thesis (in some weeks). On Mon, 5 Apr 2004 ross@soi.city.ac.uk wrote:
To have something concrete to discuss, I've placed a structure based on Edison at docs: http://www.soi.city.ac.uk/~ross/seq/ code: http://www.soi.city.ac.uk/~ross/seq.tar.gz
PS: Dessy also started with (list-compatible) Sequences and than added the rest. We should certainly not make that detour on the large scale. Robert
participants (3)
-
ajb@spamcop.net
-
Robert Will
-
ross@soi.city.ac.uk