From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: (define* (((f a) b) c) ...) Date: Tue, 15 Mar 2011 09:37:55 +0100 Message-ID: <87pqpsn5i4.fsf@gnu.org> References: <20110313154926.GA14534@e15.cs.rochester.edu> 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 1300178294 18922 80.91.229.12 (15 Mar 2011 08:38:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 15 Mar 2011 08:38:14 +0000 (UTC) Cc: guile-user@gnu.org To: Dan Gildea Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Mar 15 09:38:09 2011 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PzPlY-00010N-UT for guile-user@m.gmane.org; Tue, 15 Mar 2011 09:38:09 +0100 Original-Received: from localhost ([127.0.0.1]:58987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzPlY-0001ay-0J for guile-user@m.gmane.org; Tue, 15 Mar 2011 04:38:08 -0400 Original-Received: from [140.186.70.92] (port=41670 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzPlP-0001Zd-Oj for guile-user@gnu.org; Tue, 15 Mar 2011 04:38:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzPlO-0003E3-Bj for guile-user@gnu.org; Tue, 15 Mar 2011 04:37:59 -0400 Original-Received: from solo.fdn.fr ([80.67.169.19]:47826) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzPlO-0003Dw-5j for guile-user@gnu.org; Tue, 15 Mar 2011 04:37:58 -0400 Original-Received: from nixey (unknown [193.50.110.208]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) (Authenticated sender: lcourtes) by smtp.fdn.fr (Postfix) with ESMTPSA id 9A683441AD; Tue, 15 Mar 2011 09:37:56 +0100 (CET) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 25 =?iso-8859-1?Q?Vent=F4se?= an 219 de la =?iso-8859-1?Q?R=E9volution?= 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 In-Reply-To: <20110313154926.GA14534@e15.cs.rochester.edu> (Dan Gildea's message of "Sun, 13 Mar 2011 11:49:26 -0400") User-Agent: Gnus/5.110013 (No Gnus v0.13) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 80.67.169.19 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8539 Archived-At: Hi, Dan Gildea writes: > In guile 2.0, I need to use "define*" to define second-order functions > such as: > > (define* ((f a) b) ...) You should use (ice-9 curried-definitions) for this (see NEWS), and... > But define* doesn't work for higher-order functions, or for more > complicated definitions of second-order functions, such as: > > (define* (((f a) b) c) ...) > > (define* ((f #:optional a) b) ...) it also works for optional/keyword arguments: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (use-modules(ice-9 curried-definitions)) scheme@(guile-user)> (define* ((f #:optional a) b) (list a b)) scheme@(guile-user)> ((f) 2) $2 =3D (#f 2) scheme@(guile-user)> ((f 1) 2) $3 =3D (1 2) --8<---------------cut here---------------end--------------->8--- Hope this helps, Ludo=E2=80=99.