From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Implement R7RS 'define-values' Date: Fri, 07 Feb 2014 00:37:28 +0100 Message-ID: <87r47fsthj.fsf@gnu.org> References: <87txe4cmc9.fsf@netris.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1391730016 15707 80.91.229.3 (6 Feb 2014 23:40:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Feb 2014 23:40:16 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Feb 07 00:40:24 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WBYYR-0001iD-AJ for guile-devel@m.gmane.org; Fri, 07 Feb 2014 00:40:23 +0100 Original-Received: from localhost ([::1]:38773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBYYQ-0003lO-W5 for guile-devel@m.gmane.org; Thu, 06 Feb 2014 18:40:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBYYG-0003kr-Pa for guile-devel@gnu.org; Thu, 06 Feb 2014 18:40:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WBYY9-0001kc-Aj for guile-devel@gnu.org; Thu, 06 Feb 2014 18:40:12 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:57677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WBYY9-0001j5-4c for guile-devel@gnu.org; Thu, 06 Feb 2014 18:40:05 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WBYY7-0001Tn-BX for guile-devel@gnu.org; Fri, 07 Feb 2014 00:40:03 +0100 Original-Received: from reverse-83.fdn.fr ([80.67.176.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Feb 2014 00:40:03 +0100 Original-Received: from ludo by reverse-83.fdn.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Feb 2014 00:40:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 29 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: reverse-83.fdn.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 =?utf-8?Q?Pluvi=C3=B4se?= an 222 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:a2YNf1macbNI+PH8WsHRlQyonFs= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:16865 Archived-At: Mark H Weaver skribis: > This patch implements 'define-values' as a macro, with a similar > implementation strategy to the one used in the sample definition given > in the R7RS. I hope to provide a more efficient implementation on the > master branch at some point -- one which does not involve any mutation > -- but for now I'd like to provide at least something so that code that > uses it will run on the upcoming Guile 2.0.10. Sorry for the delay; looks good to me. Indeed it would be great to see in 2.2 if we can avoid walking the list of values. > + ((_ (var0 ... varn) expr) > + (and-map identifier? #'(var0 ... varn)) > + #`(begin > + (define dummy > + (call-with-values (lambda () expr) > + (case-lambda > + ((var0 ... varn) > + (list var0 ... varn)) > + (_ (%define-values-arity-error))))) Looks like this is precisely a case where top-level “hygiene” comes in handy, no? Thanks, Ludo’.