Hello, Ian Price <[email protected]> skribis:
> From fb23b4a49e9c1f5c15ef0ceb2ee1903ebfddd71a Mon Sep 17 00:00:00 2001 > From: Ian Price <[email protected]> > Date: Tue, 4 Sep 2012 13:18:58 +0100 > Subject: [PATCH] `define-public' is no a longer curried definition by > default. > > * module/ice-9/boot-9.scm (define-public): Remove currying functionality. > * module/ice-9/curried-definitions.scm (define-public): New export. Looks good to me. You now have commit access, so you’re welcome to commit it by yourself! :-) Please post patches before committing, for a start. Make sure to always rebase before committing, to avoid gratuitous merge commits if somebody else pushed changes in the meantime. If you have any doubts with Git, please ask us. > David Kastrup <[email protected]> writes: > >> I'd have expected a pointer at least somewhere (if not everywhere) among >> those links: >> >> <URL:http://www.gnu.org/software/guile/manual/html_node/Definition.html#Definition> >> >> <URL:http://www.gnu.org/software/guile/manual/html_node/Lambda-Alternatives.html#Lambda-Alternatives> > > I agree, and have provided some documentation. +1. > I'm no texinfo expert so it probably needs cleanup. In particular, I > wasn't sure of how to markup these curried forms. > From 6addaedac96ffe919d1b0cb58ed9992fbd240bf7 Mon Sep 17 00:00:00 2001 > From: Ian Price <[email protected]> > Date: Tue, 4 Sep 2012 15:36:54 +0100 > Subject: [PATCH] Document (ice-9 curried definitions) > > * doc/ref/Makefile.am(guile_TEXINFOS): Add curried.texi to list > * doc/ref/curried.texi: New file. > * doc/ref/guile.texi(Guile Modules): Add "Curried Definitions" to menu. > * doc/ref/scheme-ideas.texi(Lambda Alternatives): Refer to "Curried > Definitions" > from the `define' section. Please leave a space before opening parentheses. > +++ b/doc/ref/curried.texi > @@ -0,0 +1,53 @@ > +@c -*-texinfo-*- > +@c This is part of the GNU Guile Reference Manual. > +@c Copyright (C) 2012 > +@c Free Software Foundation, Inc. No newline. > +@node Curried Definitions > +@section Curried Definitions > + > +The macros in this section are provided by > +@lisp > +(use-modules (ice-9 curried-definitions)) > +@end lisp > +@noindent > +and replace those provided by default. > + > +Prior to guile 2, guile provided a type of definition known colloquially Should be “Guile 2.0”. > +as a ``curried definition''. The idea is to extend the syntax of > +@code{define} so that you can conveniently define procedures that return > +procedures, up to any desired depth. > + > +For example, > +@example > +(define ((foo x) y) > + (list x y)) > +@end example > +is a convenience form of > +@example > +(define foo > + (lambda (x) > + (lambda (y) > + (list x y)))) > +@end example > + > +@deffn {Syntax} define (@dots{} (name args @dots{}) @dots{}) expression > @dots{} It should be {Scheme Syntax}, for consistency with most of the manual. Instead of ‘expression’, what about ‘body @dots{}’? Also, I wonder whether the parentheses should appear at all, since it also accepts the flat form. OTOH, the only things worth describing is the parenthesized form. > +A curried version of the default @code{define}. > +@end deffn Please use a more formal, present-tense description, like “Create a top-level variable @var{name} bound to the procedure defined by @var{args}. @var{args} may be a list of formal parameters, possibly including nested formal parameter lists, in which case a higher-order procedure is created, as in the example above.” > +@deffn {Syntax} define* (@dots{} (name args @dots{}) @dots{}) expression > @dots{} Here ‘deffnx’ could be used instead, like: @deffn {Scheme Syntax} define (@dots{} (name args @dots{}) @dots{}) body @dots{} @deffnx {Scheme Syntax} define* (@dots{} (name args @dots{}) @dots{}) body @dots{} [...] @code{define*} works similarly, and accepts all the options that @code{lambda*} accepts (@pxref{lambda* and define*}). For example: @example [...] @end example @end deffn > +@deffn {Syntax} define-public (@dots{} (name args @dots{}) @dots{}) > expression @dots{} @deffnx too? > +Prior to guile 2, guile provided an extension to @code{define} syntax “Guile 2.0”. Thanks! Ludo’.
