unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Ian Price <ianprice90@googlemail.com>
Cc: 12341@debbugs.gnu.org, David Kastrup <dak@gnu.org>
Subject: bug#12341: define does not support lambda shorthand notation, define-public does
Date: Wed, 05 Sep 2012 23:16:02 +0200	[thread overview]
Message-ID: <87vcfsuq5p.fsf@gnu.org> (raw)
In-Reply-To: <87vcfu9dws.fsf@Kagami.home> (Ian Price's message of "Tue, 04 Sep 2012 13:21:39 +0100")

Hello,

Ian Price <ianprice90@googlemail.com> skribis:

> From fb23b4a49e9c1f5c15ef0ceb2ee1903ebfddd71a Mon Sep 17 00:00:00 2001
> From: Ian Price <ianprice90@googlemail.com>
> 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 <dak@gnu.org> 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 <ianprice90@googlemail.com>
> 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’.





  parent reply	other threads:[~2012-09-05 21:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03 18:05 bug#12341: define does not support lambda shorthand notation, define-public does David Kastrup
2012-09-03 20:29 ` Ludovic Courtès
2012-09-04 12:21   ` Ian Price
2012-09-04 12:36     ` David Kastrup
2012-09-04 14:37       ` Ian Price
2012-09-05 21:16     ` Ludovic Courtès [this message]
2012-09-06 20:27       ` Ian Price
2012-09-06 20:37         ` Ludovic Courtès
2012-09-06 21:37           ` Ian Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vcfsuq5p.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=12341@debbugs.gnu.org \
    --cc=dak@gnu.org \
    --cc=ianprice90@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).