bug-guile
[Top][All Lists]
Advanced

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

[bug #30070] multiple returns from map


From: Stefan Israelsson Tampe
Subject: [bug #30070] multiple returns from map
Date: Fri, 15 Jul 2011 10:45:07 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101216 Linux Mint/1 (Debian) Firefox/3.6.13

Follow-up Comment #1, bug #30070 (project guile):

Using srfi-1 and vanilla guile gives the same erroneous behavior.

I couldn't locate the vanilla map definition in the source code but looking at
srfi-1 revealed the problem.

Basically the map is a tail loop where the reversed list is built.
Then a reverse! is done to correct the list order. This is the root
of the problem. Just replacing reverse! with reverse fixes this bug but
introduces a slight performance issue of the order of say 20%. and a double of
amount of consing done in the algorithm.

It's possible to rewrite map using a tail pointer to get the correct behavior
without penalties.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30070>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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