[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12341: define does not support lambda shorthand notation, define-pub

From: Ludovic Courtès
Subject: bug#12341: define does not support lambda shorthand notation, define-public does
Date: Wed, 05 Sep 2012 23:16:02 +0200
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)


Ian Price <address@hidden> skribis:

> From fb23b4a49e9c1f5c15ef0ceb2ee1903ebfddd71a Mon Sep 17 00:00:00 2001
> From: Ian Price <address@hidden>
> 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 <address@hidden> 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.


> 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 <address@hidden>
> 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 @@
> address@hidden -*-texinfo-*-
> address@hidden This is part of the GNU Guile Reference Manual.
> address@hidden Copyright (C)  2012
> address@hidden   Free Software Foundation, Inc.

No newline.

> address@hidden Curried Definitions
> address@hidden Curried Definitions
> +
> +The macros in this section are provided by
> address@hidden
> +(use-modules (ice-9 curried-definitions))
> address@hidden lisp
> address@hidden
> +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
> address@hidden so that you can conveniently define procedures that return
> +procedures, up to any desired depth.
> +
> +For example,
> address@hidden
> +(define ((foo x) y)
> +  (list x y))
> address@hidden example
> +is a convenience form of
> address@hidden
> +(define foo
> +  (lambda (x)
> +    (lambda (y)
> +      (list x y))))
> address@hidden example
> +
> address@hidden {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}.
> address@hidden 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.”

> address@hidden {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 
  @deffnx {Scheme Syntax} define* (@dots{} (name args @dots{}) @dots{}) body 

  @code{define*} works similarly, and accepts all the options that
  @code{lambda*} accepts (@pxref{lambda* and define*}).  For example:

  @end example
  @end deffn
> address@hidden {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”.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]