[m-rev.] Fast string library

Simon Taylor stayl at cs.mu.OZ.AU
Tue May 15 12:33:32 AEST 2001


On Mon, May 14, 2001 at 12:39:19PM -0700, Ralph Becket wrote:
> This is a string ADT that supports O(1) concatenation and substring
> extraction at the expense of O(n) (very) worst case indexing.
> 
> I'm not sure where this one should go and/or whether it's worth
> adding all the standard string operations (shouldn't be too hard.)

> :- type str
>     --->    str(int, string)            % length.
>     ;       sub(int, int, str)          % index, length.
>     ;       cat(int, str, str).         % length.

The big problem with this kind of string representation is that
the builtin comparison operation won't work properly, and we
don't yet allow user-defined comparison predicates. This means
that using `str's as keys in a map won't do what you want.

This module probably isn't really usable until that's fixed.

Simon.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list