Email list hosting service & mailing list manager


Re: more efficient reference implementation bear 17 Dec 2002 15:18 UTC


On Tue, 17 Dec 2002, Sven Hartrumpf wrote:

> I would like to see the reference implementation to be improved for
> efficiency.  I found only one improvement - but others might be more
> clever - last 2 lines:

>(lambda (l alist)
>  (display (apply string-append (reverse l))))

> Should not we avoid constructing the result as a string and write
> something like this:

>(lambda (l alist)
>  (let iter ((l2 l))
>     (cond ((pair? l2)
>            (iter (cdr l2))
>            (display (car l2))))))

This bit of buried treasure is my fault, actually; Al Petrofsky's
function simply returned a string, and I went and added (display)
to make sure it actually got output.

>Thanks Ray Dillinger and Al Petrofsky for this draft SRFI!

You're welcome. My idea was to start submitting SRFI's that
concentrate on small stuff that makes scheme-code unportable
and helps implementors avoid reinventing wheels and know what's
"standard" but undocumented out there already, rather than
major additions to the language.  'Cos to my way of thinking,
there's not really much use for a nifty module system or a
nifty threading model or whatever, unless the modules are
portable between implementations -- and portability these days
founders on small stuff like what schemes do with the undefined
behaviors of (write).

				Bear