bug-guile
[Top][All Lists]
Advanced

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

Typo in ref. manual, @node lambda* Reference?


From: Eric Hanchrow
Subject: Typo in ref. manual, @node lambda* Reference?
Date: 13 Aug 2001 13:23:49 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.104

I've only just started reading about keywords, and am not sure I've
got this right.  But it seems that every place in the documentation
that says `#:key' should really say `#&key' instead -- the former
doesn't work in Guile; it complains like this:

    guile> (lambda* (bob #:key sam) '())
    /usr/share/guile/1.4/ice-9/optargs.scm:293:10: In procedure error in 
expression (error "Syntax error in fixed argument declaration."):
    /usr/share/guile/1.4/ice-9/optargs.scm:293:10: Syntax error in fixed 
argument declaration.
    ABORT: (misc-error)

whereas the latter works:

    guile> (lambda* (bob #&key sam) '())
    #<procedure (bob . lambda*:G4)>

So I suggest the follwoing patch.  I wonder if the colons in
`#:optional', #:allow-other-keys, and so on, should also be replaced
with an ampersand.

    cd /usr/local/src/guile/guile-core/doc/
    diff -wu 
/usr/local/src/guile/guile-core/doc/scheme-procedures.texi.\~1.14.\~ 
/usr/local/src/guile/guile-core/doc/scheme-procedures.texi
    --- /usr/local/src/guile/guile-core/doc/scheme-procedures.texi.~1.14.~      
Wed May 23 10:24:50 2001
    +++ /usr/local/src/guile/guile-core/doc/scheme-procedures.texi      Mon Aug 
13 13:17:12 2001
    @@ -189,7 +189,7 @@

     @example
     ext-param-list ::= [identifier]* [#:optional [ext-var-decl]+]?
    -  [#:key [ext-var-decl]+ [#:allow-other-keys]?]?
    +  [#&key [ext-var-decl]+ [#:allow-other-keys]?]?
       [[#:rest identifier]|[. identifier]]?

     ext-var-decl ::= identifier | ( identifier expression )
    @@ -218,7 +218,7 @@
     defined like this:

     @lisp
    -(lambda* (#:key xyzzy larch) '())
    +(lambda* (#&key xyzzy larch) '())
     @end lisp

     can be called with any of the argument lists @code{(#:xyzzy 11)}
    @@ -230,7 +230,7 @@
     two-item list in place of an optional argument, for example in:

     @lisp
    -(lambda* (foo #:optional (bar 42) #:key (baz 73))
    +(lambda* (foo #:optional (bar 42) #&key (baz 73))
          (list foo bar baz))
     @end lisp

    @@ -250,7 +250,7 @@
     last one passed is the one that takes effect. For example,

     @lisp
    -((lambda* (#:key (heads 0) (tails 0)) (display (list heads tails)))
    +((lambda* (#&key (heads 0) (tails 0)) (display (list heads tails)))
         #:heads 37 #:tails 42 #:heads 99)
     @end lisp

    @@ -294,7 +294,7 @@
     currying, just like Guile's define. Some examples:

     @lisp
    -(define* (x y #:optional a (z 3) #:key w . u)
    +(define* (x y #:optional a (z 3) #&key w . u)
        (display (list y z u)))
     @end lisp
     defines a procedure @code{x} with a fixed argument @var{y}, an optional
    @@ -317,7 +317,7 @@
     @deffnx {library syntax} defmacro*-public name formals body
     These are just like @code{defmacro} and @code{defmacro-public} except that 
they
     take @code{lambda*}-style extended paramter lists, where @code{#:optional},
    address@hidden:key}, @code{#:allow-other-keys} and @code{#:rest} are 
allowed with the usual
    address@hidden&key}, @code{#:allow-other-keys} and @code{#:rest} are 
allowed with the usual
     semantics. Here is an example of a macro with an optional argument:

     @lisp

    Diff finished at Mon Aug 13 13:17:18

-- 
PGP Fingerprint: 3E7B A3F3 96CA 8958 ACC5  C8BD 6337 0041 C01C 5276



reply via email to

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