From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: early termination for `map' Date: Thu, 05 May 2011 20:40:40 +0200 Message-ID: References: <8739kt2jxb.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1304620856 26508 80.91.229.12 (5 May 2011 18:40:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 5 May 2011 18:40:56 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu May 05 20:40:51 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QI3Tm-0007wL-LW for guile-devel@m.gmane.org; Thu, 05 May 2011 20:40:50 +0200 Original-Received: from localhost ([::1]:36413 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI3Tl-0001M4-VA for guile-devel@m.gmane.org; Thu, 05 May 2011 14:40:50 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:45185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI3Tk-0001Lx-C2 for guile-devel@gnu.org; Thu, 05 May 2011 14:40:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QI3Tj-000736-7c for guile-devel@gnu.org; Thu, 05 May 2011 14:40:48 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:43630 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI3Tj-00072w-4r; Thu, 05 May 2011 14:40:47 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 9DF6342BF; Thu, 5 May 2011 14:42:50 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=56/FZDMnmIG0 Jd8iDuZpa0dh6k4=; b=kePqbUeeShbM9ira6TYXQEBobecuvJdWP5gkmc3Zan9H ZH49YywE+ph8K1k5DtdNQVIAmA9doEoan6cw7ECmC1kf3j0MBpy0P3Z2oVEwiR4S /h7SKM3MFCcwMmqis/1EMBuyCda8ie9PcTgdOJF1Gq662JR/cz+aaYMhVmK/rjI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=yM1FDe pOkqGaBl1eqiWff2kV+NtZ0zHt4ZsOcN/hcexZQlg0lLRzBx2XtlBMU8JzqJ1v7S gp3nUsZJim9SgeDSrckm14vPP8Apy97PCHbCcGBm4+dwE3ERPQD5E93TRgTt/YhV D5pL4uDiBu1cV539ZfAVcEag46OLJrOl2Yi8A= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 8A6E442BE; Thu, 5 May 2011 14:42:49 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id CA0FF42BD; Thu, 5 May 2011 14:42:47 -0400 (EDT) In-Reply-To: <8739kt2jxb.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Thu, 05 May 2011 18:26:08 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 7A081D24-7747-11E0-B4C9-90BEB0B5FC3A-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12436 Archived-At: On Thu 05 May 2011 18:26, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Andy Wingo writes: > >> If you call `map' or `for-each' with more than one list, our versions of >> these operators will detect if the lists are of unequal length, and >> throw an error in that case. >> >> However, SRFI-1 has long provided an extension to this, to allow for >> early termination when any of the lists runs out. R6RS adopted this, >> and it looks like R7RS will ratify that. >> >> So perhaps it's time for us to change as well. > > To change the default =E2=80=98map=E2=80=99 & =E2=80=98for-each=E2=80=99 = to do like SRFI-1=E2=80=99s, right? Yeah, that was the proposal; but the argument is a bit weaker, now that I found that the R6RS did not go with this change. So I don't really know. The reason I was thinking of doing this is because it turns out to help performance to have map in scheme, at this point; or at least not hurt it, and things will get better when we grow an optimizer. So I implemented map in Scheme, with circularity detection and all, only to find strange errors in the ecmascript compiler (!). Turns out those errors happened when loading goops, because it tried to extend a primitive generic, but map wasn't a primitive any more, and instead of failing nicely it corrupted memory. >> This would also allow us to get rid of the hack in srfi-1.c in which, >> when and if GOOPS gets loaded, srfi-1 extends the `map' and `for-each' >> primitive generics with its own early-termination code, which in effect >> gives early termination to every `map' user, regardless of whether that >> module has imported srfi-1 or goops. Sometimes I think that Mikael put >> the Oops in Goops for a reason ;-) > > Heh. :-) > > Code not using GOOPS can tell the difference between the default and > SRFI-1 versions, and it can arrange to explicitly use one or the other. > So changing the default versions would be an incompatibility=E2=80=94argu= ably > not an important one, but still maybe enough to wait until 2.2? Yeah, perhaps you are right, and the srfi-1 / goops interaction should probably get some other resolution -- like merge-generics on import, or something. Thanks for your thoughts, Andy --=20 http://wingolog.org/