bug-guile
[Top][All Lists]
Advanced

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

Re: [bug #30070] multiple returns from map


From: Stefan Israelsson Tampe
Subject: Re: [bug #30070] multiple returns from map
Date: Sun, 14 Aug 2011 22:52:29 +0200

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 <address@hidden> wrote:
On Sat 13 Aug 2011 17:56, Stefan Israelsson Tampe <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]