[Prev][Next][Index][Thread]

Question about collections



Hello,

I have a question about Dylan's collection protocol. 

I'm implementing a random access list[*] as described in Chris
Okasaki's _Purely Functional Data Structures_, and I'd like it to be a
well-behaved member of the <collection> class. Since it's purely
functional, it's obviously not mutable, but I'm not sure what exactly
the difference the <mutable-collection> and <stretchy-collection>
mixins is.

Does stretchines mean that size can change without losing object
identity, or is it something else? I'm guessing the latter from the
fact that <list> isn't a <stretchy-collection>, but I'm honestly not
sure. (On a side note, is the type-for-copy generic documented
anywhere?)

[*] O(1) head and tail methods, and O(log N) access and update of
arbitrary elements. Update is functional, in the sense that it creates
a new RAL rather than mutating the old one. 


Neel



Follow-Ups: