returning a freshly allocated list?
Chongkai Zhu 09 Apr 2007 00:32 UTC
According to the specification, merge should return a *freshly* *allocated* list as its result.
But the reference implementation is:
(define (merge a b less? . opt-key)
(define key (if (null? opt-key) identity (car opt-key)))
(cond ((null? a) b)
((null? b) a)...which is trying to avoid allocating as much as possible.
Solution: either remove the "freshly allocated" requirement in the specification, or to use (map identity lst) where needed in the reference implementation.
Chongkai