more efficient reference implementation Sven Hartrumpf 17 Dec 2002 14:08 UTC

I would like to see the reference implementation to be improved for efficiency.
Yes, I know that efficiency is not a requirement for SRFI reference
implementions.  But many Scheme implementors just copy the reference
implementation without modifications in order to save time - which is
understandable but bad for many users.

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))))))

Greetings
Sven

P.S.
Thanks Ray Dillinger and Al Petrofsky for this draft SRFI!