Interestingly there is another option assuming some magic,

Consider:
(define (map f L)
   (clear-recurrent-flag)
   (let ((ret (let loop ((L L) (R '())) (if (pair? L) (loop (cdr L) (cons
(car L) R)) R))))
      (got-recurrent?
          (reverse  ret)
          (reverse! ret))))

/Stefan

On Sun, Aug 14, 2011 at 10:03 PM, Andy Wingo <[email protected]> wrote:

> On Sat 13 Aug 2011 17:56, Stefan Israelsson Tampe <[email protected]>
> writes:
>
> > Yes a tail pointer was a mind slip . But I did
> > changed the final reverse! to the functional reverse in the srfi-1
> version of map
> > and doing that should be enough.
>
> Yes, however there is a performance penalty.  We should probably do that
> for R6RS.  But long-term, we need a solution that does not impose a
> performance penalty.  That solution is to map recursively instead of
> iteratively.
>
> Andy
> --
> http://wingolog.org/
>

Reply via email to