srfi-129 (titlecase) comments Per Bothner (06 Jan 2016 19:52 UTC)
Re: srfi-129 (titlecase) comments John Cowan (13 Jan 2016 01:45 UTC)
Re: srfi-129 (titlecase) comments Per Bothner (13 Jan 2016 05:04 UTC)

Re: srfi-129 (titlecase) comments John Cowan 13 Jan 2016 01:45 UTC

Per Bothner scripsit:

> However, the reference implementation seems designed to be maximally
> inefficient, and thus not something I'd be happy to include in Kawa.

I should think that Kawa would be the least likely Scheme to adopt the
sample implementation, because the underlying Java already handles
titlecase.  (It does not meet the NIST definition of a reference
implementation, "an implementation of a specification to be used as a
definitive interpretation for that specification", because it is not
definitive -- the prose is.)

> I realize a reference implementation must prioritize correctness and
> portability for it would be nice if it is usable without a total
> re-write.

Rather, my goals were correctness, clarity, and portability to almost
any Scheme with Unicode characters (whatever else it does or does not
have).  Efficiency simply wasn't relevant.

> The string-titlecase function seems perfect for SRFI-118
> string-append! or or more portably open-output-string.

Unfortunately, R6RS and R7RS have different versions of
open-output-string, and R5RS doesn't have anything like it.

> Kawa has fast switches on integers - as does many other language
> implementations.  It would be nice if the mapping tables where in a
> macro-friendly format, so they could be transformed into association
> lists, hash tables, or case expressions with some file inclusion and
> macros.

Is the implementation of switches fast over such a large range of keys?
In any case, if you are going to use the tables, it's easy to do a
one-time transformation using a custom program to whatever format you
want, as the tables aren't at all likely to be updated in future.

--
John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
While staying with the Asonu, I met a man from the Candensian plane,
which is very much like ours, only more of it consists of Toronto.
        --Ursula K. Le Guin, Changing Planes