unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Stefan Israelsson Tampe <INVALID.NOREPLY@gnu.org>
To: Szavai Gyula <szgyg@ludens.elte.hu>,
	Stefan Israelsson Tampe <stefan.itampe@gmail.com>,
	bug-guile@gnu.org
Subject: [bug #30070] multiple returns from map
Date: Fri, 15 Jul 2011 10:45:07 +0000	[thread overview]
Message-ID: <20110715-104507.sv78157.85748@savannah.gnu.org> (raw)
In-Reply-To: <20100607-182303.sv74648.31837@savannah.gnu.org>

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	other threads:[~2011-07-15 10:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-07 18:23 [bug #30070] multiple returns from map Szavai Gyula
2011-07-15 10:45 ` Stefan Israelsson Tampe [this message]
2011-08-12 21:03   ` Andy Wingo
2011-08-13 15:56     ` Stefan Israelsson Tampe
2011-08-14 20:03       ` Andy Wingo
2011-08-14 20:52         ` Stefan Israelsson Tampe
2011-08-17 21:29     ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110715-104507.sv78157.85748@savannah.gnu.org \
    --to=invalid.noreply@gnu.org \
    --cc=bug-guile@gnu.org \
    --cc=stefan.itampe@gmail.com \
    --cc=szgyg@ludens.elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).