[m-dev.] New datatype: rope

Paul Bone pbone at csse.unimelb.edu.au
Thu Nov 11 13:24:41 AEDT 2010

On Thu, Nov 11, 2010 at 12:55:27PM +1100, Peter Schachte wrote:
> On 11/11/10 12:27, Paul Bone wrote:
> > Does anyone see any problem with this idea or a simpler implementation?
> No problem with it, but how about generalising it by allowing segments of the
> rope to be made of any instance of a sequence type class?  Then you could make
> a rope from separate bits of strings, arrays, lists, substrings, basically
> anything you have lying around that somehow implements a sequential collection
> of homogeneous things?  I'm not sure what the best set of methods for the type
> class are, but something equivalent to CAR, CDR, CONS and NIL.

This is probably okay, provided that you include elem and slice operations and
probably right-hand-side equivilents of CAR CDR and CONS.  I'd also like to see
more typeclasses in the standard library for collections.  Mutterings have also
been made about first class, and possibly parametric modules.  That is, rather
than use type classes use modules that can be parameterised by other modules.

    import cord(list) as cord_using_lists
    import cord(slice) as cord_using_slices

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/developers/attachments/20101111/ca39964e/attachment.sig>

More information about the developers mailing list