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

Re: Substring indices everywhere? Eating a cake without destroying it

This page is part of the web mail archives of SRFI 13 from before July 7th, 2015. The new archives for SRFI 13 contain all messages, not just those from before July 7th, 2015.

oleg@xxxxxxxxx writes:

> What exactly is the XS>< form? It's up to an implementation. One
> Scheme system may choose to implement (XS>< str ind1 ind2) as
> (substring str ind1 ind2). This is the easiest (albeit not very
> efficient) approach.  In this case, (XS>< str ind1 ind2) is a real
> string, so we can use R5RS string->number, string=?, etc. procedures
> as they are.

Why not just allow an implementation to "inline" substring?
Instead of:
        (string->number (XS>< "$12345.99" 1))
the programmer would write:
        (string->number (substring "$12345.99" 1))
and the implementation can re-write this as:
        (%%substring->number "$12345.99" 1)
	--Per Bothner
per@xxxxxxxxxxx   http://www.bothner.com/~per/