/[guile]/guile/guile-core/doc/ref/scheme-procedures.texi
ViewVC logotype

Diff of /guile/guile-core/doc/ref/scheme-procedures.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.3 by ttn, Wed Nov 14 18:26:26 2001 UTC revision 1.1.2.4 by ttn, Tue Jan 8 09:22:37 2002 UTC
# Line 5  Line 5 
5  @menu  @menu
6  * Lambda::                      Basic procedure creation using lambda.  * Lambda::                      Basic procedure creation using lambda.
7  * Optional Arguments::          Handling keyword, optional and rest arguments.  * Optional Arguments::          Handling keyword, optional and rest arguments.
8  * Procedure Properties::        Procedure properties and metainformation.  * Procedure Properties::        Procedure properties and meta-information.
9  * Procedures with Setters::     Procedures with setters.  * Procedures with Setters::     Procedures with setters.
10  * Macros::                      Lisp style macro definitions.  * Macros::                      Lisp style macro definitions.
11  * Syntax Rules::                Support for R5RS @code{syntax-rules}.  * Syntax Rules::                Support for R5RS @code{syntax-rules}.
# Line 66  called, the sequence of actual arguments Line 66  called, the sequence of actual arguments
66  stored into the newly created location for the formal variable.  stored into the newly created location for the formal variable.
67  @item (@var{variable1} @dots{} @var{variablen} . @var{variablen+1})  @item (@var{variable1} @dots{} @var{variablen} . @var{variablen+1})
68  If a space-delimited period precedes the last variable, then the  If a space-delimited period precedes the last variable, then the
69  procedure takes @var{n} or more variablesm where @var{n} is the number  procedure takes @var{n} or more variables where @var{n} is the number
70  of formal arguments before the period.  There must be at least one  of formal arguments before the period.  There must be at least one
71  argument before the period.  The first @var{n} actual arguments will be  argument before the period.  The first @var{n} actual arguments will be
72  stored into the newly allocated locations for the first @var{n} formal  stored into the newly allocated locations for the first @var{n} formal
# Line 196  ext-var-decl ::= identifier | ( identifi Line 196  ext-var-decl ::= identifier | ( identifi
196  @end example  @end example
197    
198  The characters `*', `+' and `?' are not to be taken literally; they mean  The characters `*', `+' and `?' are not to be taken literally; they mean
199  respectively, zero or more occurences, one or more occurences, and one  respectively, zero or more occurrences, one or more occurrences, and one
200  or zero occurences.  or zero occurrences.
201    
202  @deffn {library syntax} lambda* formals body  @deffn {library syntax} lambda* formals body
203  @code{lambda*} creates a procedure that takes optional arguments. These  @code{lambda*} creates a procedure that takes optional arguments. These
204  are specified by putting them inside brackets at the end of the  are specified by putting them inside brackets at the end of the
205  paramater list, but before any dotted rest argument. For example,  parameter list, but before any dotted rest argument. For example,
206    
207  @lisp  @lisp
208  (lambda* (a b #:optional c d . e) '())  (lambda* (a b #:optional c d . e) '())
# Line 298  currying, just like Guile's define. Some Line 298  currying, just like Guile's define. Some
298     (display (list y z u)))     (display (list y z u)))
299  @end lisp  @end lisp
300  defines a procedure @code{x} with a fixed argument @var{y}, an optional  defines a procedure @code{x} with a fixed argument @var{y}, an optional
301  agument @var{a}, another optional argument @var{z} with default value 3,  argument @var{a}, another optional argument @var{z} with default value 3,
302  a keyword argument @var{w}, and a rest argument @var{u}.  a keyword argument @var{w}, and a rest argument @var{u}.
303    
304  @lisp  @lisp
# Line 316  Of course, @code{define*[-public]} also Line 316  Of course, @code{define*[-public]} also
316  @deffn {library syntax} defmacro* name formals body  @deffn {library syntax} defmacro* name formals body
317  @deffnx {library syntax} defmacro*-public name formals body  @deffnx {library syntax} defmacro*-public name formals body
318  These are just like @code{defmacro} and @code{defmacro-public} except that they  These are just like @code{defmacro} and @code{defmacro-public} except that they
319  take @code{lambda*}-style extended paramter lists, where @code{#:optional},  take @code{lambda*}-style extended parameter lists, where @code{#:optional},
320  @code{#:key}, @code{#:allow-other-keys} and @code{#:rest} are allowed with the usual  @code{#:key}, @code{#:allow-other-keys} and @code{#:rest} are allowed with the usual
321  semantics. Here is an example of a macro with an optional argument:  semantics. Here is an example of a macro with an optional argument:
322    
# Line 328  semantics. Here is an example of a macro Line 328  semantics. Here is an example of a macro
328    
329    
330  @node Procedure Properties  @node Procedure Properties
331  @section Procedure Properties and Metainformation  @section Procedure Properties and Meta-information
332    
333  @c FIXME::martin: Review me!  @c FIXME::martin: Review me!
334    
335  Procedures always have attached the environment in which they were  Procedures always have attached the environment in which they were
336  created and information about how to apply them to actual arguments.  In  created and information about how to apply them to actual arguments.  In
337  addition to that, properties and metainformation can be stored with  addition to that, properties and meta-information can be stored with
338  procedures.  The procedures in this section can be used to test whether  procedures.  The procedures in this section can be used to test whether
339  a given procedure satisfies a condition; and to access and set a  a given procedure satisfies a condition; and to access and set a
340  procedure's property.  procedure's property.
# Line 429  Return the source property specified by Line 429  Return the source property specified by
429  @cindex procedure with setter  @cindex procedure with setter
430  @cindex setter  @cindex setter
431  A @dfn{procedure with setter} is a special kind of procedure which  A @dfn{procedure with setter} is a special kind of procedure which
432  normally behaves like any accesor procedure, that is a procedure which  normally behaves like any accessor procedure, that is a procedure which
433  accesses a data structure.  The difference is that this kind of  accesses a data structure.  The difference is that this kind of
434  procedure has a so-called @dfn{setter} attached, which is a procedure  procedure has a so-called @dfn{setter} attached, which is a procedure
435  for storing something into a data structure.  for storing something into a data structure.
# Line 658  given by the <transformer-spec>. Line 658  given by the <transformer-spec>.
658  @node Internal Macros  @node Internal Macros
659  @section Internal Representation of Macros and Syntax  @section Internal Representation of Macros and Syntax
660    
661  Internally, Guile uses three different flavours of macros.  The three  Internally, Guile uses three different flavors of macros.  The three
662  flavours are called @dfn{acro} (or @dfn{syntax}), @dfn{macro} and  flavors are called @dfn{acro} (or @dfn{syntax}), @dfn{macro} and
663  @dfn{mmacro}.  @dfn{mmacro}.
664    
665  Given the expression  Given the expression
# Line 669  Given the expression Line 669  Given the expression
669  @end lisp  @end lisp
670    
671  @noindent  @noindent
672  with @code{foo} being some flavour of macro, one of the following things  with @code{foo} being some flavor of macro, one of the following things
673  will happen when the expression is evaluated.  will happen when the expression is evaluated.
674    
675  @itemize @bullet  @itemize @bullet
# Line 743  first symbol in an expression, evaluates Line 743  first symbol in an expression, evaluates
743  of the containing code.  of the containing code.
744  @end deffn  @end deffn
745    
746  In the following primitives, @dfn{acro} flavour macros are referred to  In the following primitives, @dfn{acro} flavor macros are referred to
747  as @dfn{syntax transformers}.  as @dfn{syntax transformers}.
748    
749  @deffn primitive macro? obj  @deffn primitive macro? obj

Legend:
Removed from v.1.1.2.3  
changed lines
  Added in v.1.1.2.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26