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

more efficient reference implementation

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



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!