guile-cvs
[Top][All Lists]
Advanced

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

guile/guile-core/doc ChangeLog Makefile.am guil...


From: Martin Grabmueller
Subject: guile/guile-core/doc ChangeLog Makefile.am guil...
Date: Mon, 14 May 2001 14:37:56 -0700

CVSROOT:        /cvs
Module name:    guile
Changes by:     Martin Grabmueller <address@hidden>     01/05/14 14:37:51

Modified files:
        guile-core/doc : ChangeLog Makefile.am guile.texi 
                         srfi-modules.texi 
Removed files:
        guile-core/doc : srfi-13-14.texi 

Log message:
        * srfi-13-14.texi: Removed.
        
        * srfi-modules.texi (SRFI-13): Merged SRFI-13 docs into SRFI
        chapter.
        (SRFI-14): Merged SRFI-14 too.
        
        * guile.texi (Top): Remove inclusion of obsolete SRFI-13/14 file.
        
        * srfi-modules.texi (SRFI-0): New section.
        (SRFI-16): New section.
        
        Change `--' to `-' throughout.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/doc/ChangeLog.diff?cvsroot=OldCVS&tr1=1.87&tr2=1.88&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/doc/Makefile.am.diff?cvsroot=OldCVS&tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/doc/guile.texi.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/doc/srfi-modules.texi.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: guile/guile-core/doc/ChangeLog
diff -u guile/guile-core/doc/ChangeLog:1.87 guile/guile-core/doc/ChangeLog:1.88
--- guile/guile-core/doc/ChangeLog:1.87 Sun May 13 12:16:20 2001
+++ guile/guile-core/doc/ChangeLog      Mon May 14 14:37:51 2001
@@ -1,3 +1,18 @@
+2001-05-14  Martin Grabmueller  <address@hidden>
+
+       * srfi-13-14.texi: Removed.
+
+       * srfi-modules.texi (SRFI-13): Merged SRFI-13 docs into SRFI
+       chapter.
+       (SRFI-14): Merged SRFI-14 too.
+
+       * guile.texi (Top): Remove inclusion of obsolete SRFI-13/14 file.
+
+       * srfi-modules.texi (SRFI-0): New section.
+       (SRFI-16): New section.
+       
+       Change `--' to `-' throughout.
+
 2001-05-13  Thien-Thi Nguyen  <address@hidden>
 
        * intro.texi, scheme-modules.texi, scheme-procedures.texi:
Index: guile/guile-core/doc/Makefile.am
diff -u guile/guile-core/doc/Makefile.am:1.17 
guile/guile-core/doc/Makefile.am:1.18
--- guile/guile-core/doc/Makefile.am:1.17       Wed May  2 14:50:15 2001
+++ guile/guile-core/doc/Makefile.am    Mon May 14 14:37:51 2001
@@ -35,7 +35,7 @@
        scheme-reading.texi scheme-indices.texi slib.texi posix.texi \
        expect.texi scsh.texi tcltk.texi scripts.texi gh.texi scm.texi \
        appendices.texi indices.texi script-getopt.texi data-rep.texi \
-       extend.texi srfi-13-14.texi repl-modules.texi srfi-modules.texi \
+       extend.texi repl-modules.texi srfi-modules.texi \
        AUTHORS
 
 guile_tut_TEXINFOS = guile-tut.texi AUTHORS
Index: guile/guile-core/doc/guile.texi
diff -u guile/guile-core/doc/guile.texi:1.8 guile/guile-core/doc/guile.texi:1.9
--- guile/guile-core/doc/guile.texi:1.8 Wed May  2 14:50:15 2001
+++ guile/guile-core/doc/guile.texi     Mon May 14 14:37:51 2001
@@ -80,7 +80,7 @@
 @sp 10
 @comment The title is printed in a large font.
 @title Guile Reference Manual
address@hidden $Id: guile.texi,v 1.8 2001/05/02 21:50:15 mgrabmue Exp $
address@hidden $Id: guile.texi,v 1.9 2001/05/14 21:37:51 mgrabmue Exp $
 @subtitle For use with Guile @value{VERSION}
 @include AUTHORS
 
@@ -169,7 +169,6 @@
 * SLIB::                        Using the SLIB Scheme library.
 * POSIX::                       POSIX system calls and networking.
 * SRFI Support::                Support for various SRFIs.
-* SRFI-13/14::                  String library and character set library.
 * Readline Support::            Module for using the readline library.
 * Value History::               Maintaining a value history in the REPL.
 * Expect::                     Controlling interactive programs with Guile.
@@ -253,7 +252,6 @@
 @include slib.texi
 @include posix.texi
 @include srfi-modules.texi
address@hidden srfi-13-14.texi
 @include repl-modules.texi
 @include expect.texi
 @include scsh.texi
Index: guile/guile-core/doc/srfi-modules.texi
diff -u guile/guile-core/doc/srfi-modules.texi:1.1 
guile/guile-core/doc/srfi-modules.texi:1.2
--- guile/guile-core/doc/srfi-modules.texi:1.1  Wed May  2 14:50:15 2001
+++ guile/guile-core/doc/srfi-modules.texi      Mon May 14 14:37:51 2001
@@ -1,26 +1,95 @@
 @node SRFI Support
 @chapter Various SRFI Support Modules
 
-In addition to the string and character--set libraries --- documented in
-the next chapter --- Guile has support for a number of SRFIs.  This
+SRFI is an acronym for Scheme Request For Implementation.  The SRFI
+documents define a lot of syntactic and procedure extensions to standard
+Scheme as defined in R5RS.
+
+In addition to the string and character-set libraries---documented in
+the next chapter---Guile has support for a number of SRFIs.  This
 chapter gives an overview over the available SRFIs and some usage hints.
-For complete documentation, we advise you to get the relevant SRFI
-documents from the SRFI home page @url{http://srfi.schemers.org}.
+For complete documentation, design rationales and further examples, we
+advise you to get the relevant SRFI documents from the SRFI home page
address@hidden://srfi.schemers.org}.
 
 @menu
+* SRFI-0::                      cond-expand
 * SRFI-2::                      and-let*.
 * SRFI-6::                      Basic String Ports.
 * SRFI-8::                      receive.
 * SRFI-9::                      define-record-type.
-* SRFI-10::                     Hash--Comma Reader Extension.
+* SRFI-10::                     Hash-Comma Reader Extension.
 * SRFI-11::                     let-values and let-values*.
+* SRFI-13::                     String library.
+* SRFI-14::                     Character-set library.
+* SRFI-16::                     case-lambda
 * SRFI-17::                     Generalized set!
 @end menu
 
 
address@hidden SRFI-0
address@hidden SRFI-0 - cond-expand
+
address@hidden FIXME::martin: Review me!
+
+SRFI-0 defines a means for checking whether a Scheme implementation has
+support for a specified feature.  The syntactic form @code{cond-expand},
+which implements this means, has the following syntax.
+
address@hidden
+<cond-expand>
+  --> (cond-expand <cond-expand-clause>+)
+    | (cond-expand <cond-expand-clause>* (else <command-or-definition>))
+<cond-expand-clause>
+  --> (<feature-requirement> <command-or-definition>*)
+<feature-requirement>
+  --> <feature-identifier>
+    | (and <feature-requirement>*)
+    | (or <feature-requirement>*)
+    | (not <feature-requirement>)
+<feature-identifier>
+  --> <a symbol which is the name or alias of a SRFI>
address@hidden example
+
+When evaluated, this form checks all clauses in order, until it finds
+one whose feature requirement is satisfied.  Then the form expands into
+the commands or definitions in the clause.  A requirement is tested as
+follows:
+
address@hidden @bullet
address@hidden
+If it is a symbol, it is satisfied if the feature identifier is
+supported.
+
address@hidden
+If it is an @code{and} form, all requirements must be satisfied.  If no
+requirements are given, it is satisfied, too.
+
address@hidden
+If it is an @code{or} form, at least one of the requirements must be
+satisfied.  If no requirements are given, it is not satisfied.
+
address@hidden
+If it is a @code{not} form, the feature requirement must @emph{not} be
+satisfied.
+
address@hidden
+If the feature requirement is the keyword @code{else} and it is the last
+clause, it is satisfied if no prior clause matched.
address@hidden itemize
+
+Since @code{cond-expand} is needed to tell what a Scheme implementation
+provides, it must be accessible without using any
+implementation-dependant operations, such as @code{use-modules} in
+Guile.  Thus, it is not necessary to use any module to get access to
+this form.
+
+
 @node SRFI-2
address@hidden SRFI-2 -- and-let*
address@hidden SRFI-2 - and-let*
 
address@hidden FIXME::martin: Review me!
+
 The syntactic form @code{and-let*} combines the conditional evaluation
 form @code{and} with the binding form @var{let*}.  Each argument
 expression will be evaluated sequentially, bound to a variable (if a
@@ -29,9 +98,26 @@
 
 Use @code{(use-modules (srfi srfi-2)} to access this syntax form.
 
+A short example will demonstrate how it works.  In the first expression,
address@hidden will get bound to 1, but the next expression (@code{#f}) is
+false, so evaluation of the form is stopped, and @code{#f} is returned.
+In the next expression, @var{x} is bound to 1, @var{y} is bound to
address@hidden and since no expression in the binding section was false, the
+body of the @code{and-let*} expression is evaluated, which in this case
+returns the value of @var{x}.
 
address@hidden
+(and-let* ((x 1) (y #f)) 42)
address@hidden
+#f
+(and-let* ((x 1) (y #t)) x) 
address@hidden
+1
address@hidden lisp
+
+
 @node SRFI-6
address@hidden SRFI-6 -- Basic String Ports
address@hidden SRFI-6 - Basic String Ports
 
 SRFI-6 defines the procedures @code{open-input-string},
 @code{open-output-string} and @code{get-output-string}.  These
@@ -41,14 +127,14 @@
 this module does not hurt, after all.
 
 @node SRFI-8
address@hidden SRFI-8 -- receive
address@hidden SRFI-8 - receive
 
address@hidden is a syntax for making the handling of multiple--value
address@hidden is a syntax for making the handling of multiple-value
 procedures easier.  It is documented in @xref{Multiple Values}.
 
 
 @node SRFI-9
address@hidden SRFI-9 -- define-record-type
address@hidden SRFI-9 - define-record-type
 
 This is the SRFI way for defining record types.  The Guile
 implementation is a layer above Guile's normal record construction
@@ -96,9 +182,9 @@
 
 
 @node SRFI-10
address@hidden SRFI-10 -- Hash--Comma Reader Extension
address@hidden SRFI-10 - Hash-Comma Reader Extension
 
address@hidden hash--comma
address@hidden hash-comma
 @cindex #,()
 The module @code{(srfi srfi-10)} implements the syntax extension
 @code{#,()}, also called hash-comma, which is defined in SRFI-10.
@@ -128,20 +214,20 @@
 is necessary because ports are not self-evaluating in Guile.
 
 @deffn procedure define-reader-ctor symbol proc
-Define @var{proc} as the reader constructor for hash--comma forms with a
+Define @var{proc} as the reader constructor for hash-comma forms with a
 tag @var{symbol}.  @var{proc} will be applied to the datum(s) following
-the tag in the hash--comma expression after the complete form has been
+the tag in the hash-comma expression after the complete form has been
 read in.  The result of @var{proc} is returned by the Scheme reader.
 @end deffn
 
 
 @node SRFI-11
address@hidden SRFI-11 -- let-values
address@hidden SRFI-11 - let-values
 
 This module implements the binding forms for multiple values
 @code{let-values} and @code{let-values*}.  These forms are similar to
 @code{let} and @code{let*} (REFFIXME), but they support binding of the
-values returned by multiple--valued expressions.
+values returned by multiple-valued expressions.
 
 Write @code{(use-modules (srfi srfi-11))} to make the bindings
 available.
@@ -157,12 +243,1111 @@
 @code{let-values} performs all bindings simultaneously, which means that
 no expression in the binding clauses may refer to variables bound in the
 same clause list.  @code{let-values*}, on the other hand, performs the
-bindings sequentially, just like @code{let*} does for single--valued
+bindings sequentially, just like @code{let*} does for single-valued
 expressions.
 
 
address@hidden SRFI-13
address@hidden SRFI-13 - String Library
+
+In this section, we will describe all procedures defined in SRFI-13
+(string library) and implemented by the module @code{(srfi srfi-13)}.
+
+Note that only the procedures from SRFI-13 are documented here which are
+not already contained in Guile.  For procedures not documented here
+please refer to the relevant chapters in the Guile Reference Manual, for
+example the documentation of strings and string procedures (REFFIXME).
+
+All of the procedures defined in SRFI-13, which are not already included
+in the Guile core library, are implemented in the module @code{(srfi
+srfi-13)}.  The procedures which are both in Guile and in SRFI-13, but
+which are slightly extended, have been implemented in this module, and
+the bindings overwrite those in the Guile core.
+
+The procedures which are defined in the section @emph{Low-level
+procedures} of SRFI-13 for parsing optional string indices, substring
+specification checking and Knuth-Morris-Pratt-Searching are not
+implemented.
+
+The procedures @code{string-contains} and @code{string-contains-ci} are
+not implemented very efficiently at the moment.  This will be changed as
+soon as possible.
+
address@hidden
+* Loading SRFI-13::             How to load SRFI-13 support.
+* SRFI-13 Predicates::          String predicates.
+* SRFI-13 Constructors::        String constructing procedures.
+* SRFI-13 List/String Conversion::  Conversion from/to lists.
+* SRFI-13 Selection::           Selection portions of strings.
+* SRFI-13 Modification::        Modfify strings in-place.
+* SRFI-13 Comparison::          Compare strings.
+* SRFI-13 Prefixes/Suffixes::   Detect common pre-/suffixes.
+* SRFI-13 Searching::           Searching for substrings.
+* SRFI-13 Case Mapping::        Mapping to lower-/upper-case.
+* SRFI-13 Reverse/Append::      Reverse and append strings.
+* SRFI-13 Fold/Unfold/Map::     Construct/deconstruct strings.
+* SRFI-13 Replicate/Rotate::    Replacate and rotate portions of strings.
+* SRFI-13 Miscellaneous::       Left-over string procedures.
+* SRFI-13 Filtering/Deleting::  Filter and delete characters from strings.
address@hidden menu
+
+
address@hidden Loading SRFI-13
address@hidden Loading SRFI-13
+
+When Guile is properly installed, SRFI-13 support can be loaded into a
+running Guile by using the @code{(srfi srfi-13)} module.
+
address@hidden
+$ guile
+guile> (use-modules (srfi srfi-13))
+guile>
address@hidden example
+
+When this step causes any errors, Guile is not properly installed.
+
+One possible reason is that Guile cannot find either the Scheme module
+file @file{srfi-13.scm}, or it cannot find the shared object file
address@hidden  Make sure that the former is in the
+Guile load path and that the latter is either installed in some default
+location like @file{/usr/local/lib} or that the directory it was
+installed to is in your @code{LTDL_LIBRARY_PATH}.  The same applies to
address@hidden
+
+Now you can test whether the SRFI-13 procedures are working by calling
+the @code{string-concatenate} procedure.
+
address@hidden
+guile> (string-concatenate '("Hello" " " "World!"))
+"Hello World!"
address@hidden example
+
address@hidden SRFI-13 Predicates
address@hidden Predicates 
+
+In addition to the primitives @code{string?} and @code{string-null?},
+which are already in the Guile core, the string predicates
address@hidden and @code{string-every} are defined by SRFI-13.
+
address@hidden primitive string-any pred s [start end]
+Check if the predicate @var{pred} is true for any character in
+the string @var{s}, proceeding from left (index @var{start}) to
+right (index @var{end}).  If @code{string-any} returns true,
+the returned true value is the one produced by the first
+successful application of @var{pred}.
address@hidden deffn
+
address@hidden primitive string-every pred s [start end]
+Check if the predicate @var{pred} is true for every character
+in the string @var{s}, proceeding from left (index @var{start})
+to right (index @var{end}).  If @code{string-every} returns
+true, the returned true value is the one produced by the final
+application of @var{pred} to the last character of @var{s}.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 Constructors
address@hidden Constructors
+
+SRFI-13 defines several procedures for constructing new strings.  In
+addition to @code{make-string} and @code{string} (available in the Guile
+core library), the procedure @code{string-tabulate} does exist.
+
address@hidden primitive string-tabulate proc len
address@hidden is an integer->char procedure.  Construct a string
+of size @var{len} by applying @var{proc} to each index to
+produce the corresponding string element.  The order in which
address@hidden is applied to the indices is not specified.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 List/String Conversion
address@hidden List/String Conversion
+
+The procedure @code{string->list} is extended by SRFI-13, that is why it
+is included in @code{(srfi srfi-13)}.  The other procedures are new.
+The Guile core already contains the procedure @code{list->string} for
+converting a list of characters into a string (REFFIXME).
+
address@hidden primitive string->list str [start end]
+Convert the string @var{str} into a list of characters.
address@hidden deffn
+
address@hidden primitive reverse-list->string chrs
+An efficient implementation of @code{(compose string->list
+reverse)}:
+
address@hidden
+(reverse-list->string '(#\a #\B #\c)) @result{} "cBa"
address@hidden smalllisp
address@hidden deffn
+
address@hidden primitive string-join ls [delimiter grammar]
+Append the string in the string list @var{ls}, using the string
address@hidden as a delimiter between the elements of @var{ls}.
address@hidden is a symbol which specifies how the delimiter is
+placed between the strings, and defaults to the symbol
address@hidden
+
address@hidden @code
address@hidden infix
+Insert the separator between list elements.  An empty string
+will produce an empty list.
+
address@hidden string-infix
+Like @code{infix}, but will raise an error if given the empty
+list.
+
address@hidden suffix
+Insert the separator after every list element.
+
address@hidden prefix
+Insert the separator before each list element.
address@hidden table
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 Selection
address@hidden Selection
+
+These procedures are called @dfn{selectors}, because they access
+information about the string or select pieces of a given string.
+
+Additional selector procedures are documented in the Strings section
+(REFFIXME), like @code{string-length} or @code{string-ref}.
+
address@hidden is also available in core Guile, but this version
+accepts additional start/end indices.
+
address@hidden primitive string-copy str [start end]
+Return a freshly allocated copy of the string @var{str}.  If
+given, @var{start} and @var{end} delimit the portion of
address@hidden which is copied.
address@hidden deffn
+
address@hidden primitive substring/shared str start [end]
+Like @code{substring}, but the result may share memory with the
+argument @var{str}.
address@hidden deffn
+
address@hidden primitive string-copy! target tstart s [start end]
+Copy the sequence of characters from index range address@hidden,
address@hidden) in string @var{s} to string @var{target}, beginning
+at index @var{tstart}.  The characters are copied left-to-right
+or right-to-left as needed - the copy is guaranteed to work,
+even if @var{target} and @var{s} are the same string.  It is an
+error if the copy operation runs off the end of the target
+string.
address@hidden deffn
+
address@hidden primitive string-take s n
address@hidden primitive string-take-right s n
+Return the @var{n} first/last characters of @var{s}.
address@hidden deffn
+
address@hidden primitive string-drop s n
address@hidden primitive string-drop-right s n
+Return all but the first/last @var{n} characters of @var{s}.
address@hidden deffn
+
address@hidden primitive string-pad s len [chr start end]
address@hidden primitive string-pad-right s len [chr start end]
+Take that characters from @var{start} to @var{end} from the
+string @var{s} and return a new string, right(left)-padded by the
+character @var{chr} to length @var{len}.  If the resulting
+string is longer than @var{len}, it is truncated on the right (left).
address@hidden deffn
+
address@hidden primitive string-trim s [char_pred start end]
address@hidden primitive string-trim-right s [char_pred start end]
address@hidden primitive string-trim-both s [char_pred start end]
+Trim @var{s} by skipping over all characters on the left/right/both
+sides of the string that satisfy the parameter @var{char_pred}:
+
address@hidden @bullet
address@hidden
+if it is the character @var{ch}, characters equal to
address@hidden are trimmed,
+
address@hidden
+if it is a procedure @var{pred} characters that
+satisfy @var{pred} are trimmed,
+
address@hidden
+if it is a character set, characters in that set are trimmed.
address@hidden itemize
+
+If called without a @var{char_pred} argument, all whitespace is
+trimmed.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 Modification
address@hidden Modification
+
+The procedure @code{string-fill!} is extended from R5RS because it
+accepts optional start/end indices.  This bindings shadows the procedure
+of the same name in the Guile core.  The second modification procedure
address@hidden is documented in the Strings section (REFFIXME).
+
address@hidden primitive string-fill! str chr [start end]
+Stores @var{chr} in every element of the given @var{str} and
+returns an unspecified value.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 Comparison
address@hidden Comparison
+
+The procedures in this section are used for comparing strings in
+different ways.  The comparison predicates differ from those in R5RS in
+that they do not only return @code{#t} or @code{#f}, but the mismatch
+index in the case of a true return value.
+
address@hidden and @code{string-hash-ci} are for calculating hash
+values for strings, useful for implementing fast lookup mechanisms.
+
address@hidden primitive string-compare s1 s2 proc_lt proc_eq proc_gt [start1 
end1 start2 end2]
address@hidden primitive string-compare-ci s1 s2 proc_lt proc_eq proc_gt 
[start1 end1 start2 end2]
+Apply @var{proc_lt}, @var{proc_eq}, @var{proc_gt} to the
+mismatch index, depending upon whether @var{s1} is less than,
+equal to, or greater than @var{s2}.  The mismatch index is the
+largest index @var{i} such that for every 0 <= @var{j} <
address@hidden, @address@hidden = @address@hidden - that is,
address@hidden is the first position that does not match.  The
+character comparison is done case-insensitively.
address@hidden deffn
+
address@hidden primitive string= s1 s2 [start1 end1 start2 end2]
address@hidden primitive string<> s1 s2 [start1 end1 start2 end2]
address@hidden primitive string< s1 s2 [start1 end1 start2 end2]
address@hidden primitive string> s1 s2 [start1 end1 start2 end2]
address@hidden primitive string<= s1 s2 [start1 end1 start2 end2]
address@hidden primitive string>= s1 s2 [start1 end1 start2 end2]
+Compare @var{s1} and @var{s2} and return @code{#f} if the predicate
+fails.  Otherwise, the mismatch index is returned (or @var{end1} in the
+case of @code{string=}.
address@hidden deffn
+
address@hidden primitive string-ci= s1 s2 [start1 end1 start2 end2]
address@hidden primitive string-ci<> s1 s2 [start1 end1 start2 end2]
address@hidden primitive string-ci< s1 s2 [start1 end1 start2 end2]
address@hidden primitive string-ci> s1 s2 [start1 end1 start2 end2]
address@hidden primitive string-ci<= s1 s2 [start1 end1 start2 end2]
address@hidden primitive string-ci>= s1 s2 [start1 end1 start2 end2]
+Compare @var{s1} and @var{s2} and return @code{#f} if the predicate
+fails.  Otherwise, the mismatch index is returned (or @var{end1} in the
+case of @code{string=}.  These are the case-insensitive variants.
address@hidden deffn
+
address@hidden primitive string-hash s [bound start end]
address@hidden primitive string-hash-ci s [bound start end]
+Return a hash value of the string @var{s} in the range 0 @dots{}
address@hidden - 1.  @code{string-hash-ci} is the case-insensitive variant.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 Prefixes/Suffixes
address@hidden Prefixes/Suffixes
+
+Using these procedures you can determine whether a given string is a
+prefix or suffix of another string or how long a common prefix/suffix
+is.
+
address@hidden primitive string-prefix-length s1 s2 [start1 end1 start2 end2]
address@hidden primitive string-prefix-length-ci s1 s2 [start1 end1 start2 end2]
address@hidden primitive string-suffix-length s1 s2 [start1 end1 start2 end2]
address@hidden primitive string-suffix-length-ci s1 s2 [start1 end1 start2 end2]
+Return the length of the longest common prefix/suffix of the two
+strings. @code{string-prefix-length-ci} and
address@hidden are the case-insensitive variants.
address@hidden deffn
+
address@hidden primitive string-prefix? s1 s2 [start1 end1 start2 end2]
address@hidden primitive string-prefix-ci? s1 s2 [start1 end1 start2 end2]
address@hidden primitive string-suffix? s1 s2 [start1 end1 start2 end2]
address@hidden primitive string-suffix-ci? s1 s2 [start1 end1 start2 end2]
+Is @var{s1} a prefix/suffix of @var{s2}. @code{string-prefix-ci?} and
address@hidden are the case-insensitive variants.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 Searching
address@hidden Searching
+
+Use these procedures to find out whether a string contains a given
+character or a given substring, or a character from a set of characters.
+
address@hidden primitive string-index s char_pred [start end]
address@hidden primitive string-index-right s char_pred [start end]
+Search through the string @var{s} from left to right (right to left),
+returning the index of the first (last) occurence of a character which
+
address@hidden @bullet
address@hidden
+equals @var{char_pred}, if it is character,
+
address@hidden
+satisifies the predicate @var{char_pred}, if it is a 
+procedure,
+
address@hidden
+is in the set @var{char_pred}, if it is a character set.
address@hidden itemize
address@hidden deffn
+
address@hidden primitive string-skip s char_pred [start end]
address@hidden primitive string-skip-right s char_pred [start end]
+Search through the string @var{s} from left to right (right to left),
+returning the index of the first (last) occurence of a character which
+
address@hidden @bullet
address@hidden
+does not equal @var{char_pred}, if it is character,
+
address@hidden
+does not satisify the predicate @var{char_pred}, if it is
+a procedure.
+
address@hidden
+is not in the set if @var{char_pred} is a character set.
address@hidden itemize
address@hidden deffn
+
address@hidden primitive string-count s char_pred [start end]
+Return the count of the number of characters in the string
address@hidden which
+
address@hidden @bullet
address@hidden
+equals @var{char_pred}, if it is character,
+
address@hidden
+satisifies the predicate @var{char_pred}, if it is a procedure.
+
address@hidden
+is in the set @var{char_pred}, if it is a character set.
address@hidden itemize
address@hidden deffn
+
address@hidden primitive string-contains s1 s2 [start1 end1 start2 end2]
address@hidden primitive string-contains-ci s1 s2 [start1 end1 start2 end2]
+Does string @var{s1} contain string @var{s2}?  Return the index
+in @var{s1} where @var{s2} occurs as a substring, or false.
+The optional start/end indices restrict the operation to the
+indicated substrings.
+
address@hidden is the case-insensitive variant.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 Case Mapping
address@hidden Alphabetic Case Mapping
+
+These procedures convert the alphabetic case of strings.  They are
+similar to the procedures in the Guile core, but are extended to handle
+optional start/end indices.
+
address@hidden primitive string-upcase s [start end]
address@hidden primitive string-upcase! s [start end]
+Upcase every character in @var{s}.  @code{string-upcase!} is the
+side-effecting variant.
address@hidden deffn
+
address@hidden primitive string-downcase s [start end]
address@hidden primitive string-downcase! s [start end]
+Downcase every character in @var{s}.  @code{string-downcase!} is the
+side-effecting variant.
address@hidden deffn
+
address@hidden primitive string-titlecase s [start end]
address@hidden primitive string-titlecase! s [start end]
+Upcase every first character in every word in @var{s}, downcase the
+other characters.  @code{string-titlecase!} is the side-effecting
+variant.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 Reverse/Append
address@hidden Reverse/Append
+
+One appending procedure, @code{string-append} is the same in R5RS and in
+SRFI-13, so it is not redefined.
+
address@hidden primitive string-reverse str [start end]
address@hidden primitive string-reverse! str [start end]
+Reverse the string @var{str}.  The optional arguments
address@hidden and @var{end} delimit the region of @var{str} to
+operate on.
+
address@hidden modifies the argument string and returns an
+unspecified value.
address@hidden deffn
+
address@hidden primitive string-append/shared ls @dots{}
+Like @code{string-append}, but the result may share memory
+with the argument strings.
address@hidden deffn
+
address@hidden primitive string-concatenate ls
+Append the elements of @var{ls} (which must be strings)
+together into a single string.  Guaranteed to return a freshly
+allocated string.
address@hidden deffn
+
address@hidden primitive string-concatenate/shared ls
+Like @code{string-concatenate}, but the result may share memory
+with the strings in the list @var{ls}.
address@hidden deffn
+
address@hidden primitive string-concatenate-reverse ls final_string end
+Without optional arguments, this procedure is equivalent to
+
address@hidden
+(string-concatenate (reverse ls))
address@hidden smalllisp
+
+If the optional argument @var{final_string} is specified, it is
+consed onto the beginning to @var{ls} before performing the
+list-reverse and string-concatenate operations.  If @var{end}
+is given, only the characters of @var{final_string} up to index
address@hidden are used.
+
+Guaranteed to return a freshly allocated string.
address@hidden deffn
+
address@hidden primitive string-concatenate-reverse/shared ls final_string end
+Like @code{string-concatenate-reverse}, but the result may
+share memory with the the strings in the @var{ls} arguments.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 Fold/Unfold/Map
address@hidden Fold/Unfold/Map
+
address@hidden, @code{string-for-each} etc. are for iterating over
+the characters a string is composed of.  The fold and unfold procedures
+are list iterators and constructors.
+
address@hidden primitive string-map proc s [start end]
address@hidden is a char->char procedure, it is mapped over
address@hidden  The order in which the procedure is applied to the
+string elements is not specified.
address@hidden deffn
+
address@hidden primitive string-map! proc s [start end]
address@hidden is a char->char procedure, it is mapped over
address@hidden  The order in which the procedure is applied to the
+string elements is not specified.  The string @var{s} is
+modified in-place, the return value is not specified.
address@hidden deffn
+
address@hidden primitive string-fold kons knil s [start end]
address@hidden primitive string-fold-right kons knil s [start end]
+Fold @var{kons} over the characters of @var{s}, with @var{knil} as the
+terminating element, from left to right (or right to left, for
address@hidden).  @var{kons} must expect two arguments: The
+actual character and the last result of @var{kons}' application.
address@hidden deffn
+
address@hidden primitive string-unfold p f g seed [base make_final]
address@hidden primitive string-unfold-right p f g seed [base make_final]
+These are the fundamental string constructors.
address@hidden @bullet
address@hidden @var{g} is used to generate a series of @emph{seed}
+values from the initial @var{seed}: @var{seed}, (@var{g}
address@hidden), (@var{g}^2 @var{seed}), (@var{g}^3 @var{seed}),
address@hidden
address@hidden @var{p} tells us when to stop - when it returns true
+when applied to one of these seed values.
address@hidden @var{f} maps each seed value to the corresponding 
+character in the result string.  These chars are assembled into the
+string in a left-to-right (right-to-left) order.
address@hidden @var{base} is the optional initial/leftmost (rightmost)
+ portion of the constructed string; it default to the empty string.
address@hidden @var{make_final} is applied to the terminal seed
+value (on which @var{p} returns true) to produce the final/rightmost
+(leftmost) portion of the constructed string.  It defaults to
address@hidden(lambda (x) "")}.
address@hidden itemize
address@hidden deffn
+
address@hidden primitive string-for-each proc s [start end]
address@hidden is mapped over @var{s} in left-to-right order.  The
+return value is not specified.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 Replicate/Rotate
address@hidden Replicate/Rotate
+
+These procedures are special substring procedures, which can also be
+used for replicating strings.  They are a bit tricky to use, but
+consider this code fragment, which replicates the input string
address@hidden"foo"} so often that the resulting string has a length of six.
+
address@hidden
+(xsubstring "foo" 0 6)
address@hidden
+"foofoo"
address@hidden lisp
+
address@hidden primitive xsubstring s from [to start end]
+This is the @emph{extended substring} procedure that implements
+replicated copying of a substring of some string.
+
address@hidden is a string, @var{start} and @var{end} are optional
+arguments that demarcate a substring of @var{s}, defaulting to
+0 and the length of @var{s}.  Replicate this substring up and
+down index space, in both the positive and negative directions.
address@hidden returns the substring of this string
+beginning at index @var{from}, and ending at @var{to}, which
+defaults to @var{from} + (@var{end} - @var{start}).
address@hidden deffn
+
address@hidden primitive string-xcopy! target tstart s sfrom [sto start end]
+Exactly the same as @code{xsubstring}, but the extracted text
+is written into the string @var{target} starting at index
address@hidden  The operation is not defined if @code{(eq?
address@hidden @var{s})} or these arguments share storage - you
+cannot copy a string on top of itself.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 Miscellaneous
address@hidden Miscellaneous
+
address@hidden is for replacing a portion of a string with
+another string and @code{string-tokenize} splits a string into a list of
+strings, breaking it up at a specified character.
+
address@hidden primitive string-replace s1 s2 [start1 end1 start2 end2]
+Return the string @var{s1}, but with the characters
address@hidden @dots{} @var{end1} replaced by the characters
address@hidden @dots{} @var{end2} from @var{s2}.
address@hidden deffn
+
address@hidden primitive string-tokenize s [token_char start end]
+Split the string @var{s} into a list of substrings, where each
+substring is a maximal non-empty contiguous sequence of
+characters equal to the character @var{token_char}, or
+whitespace, if @var{token_char} is not given.  If
address@hidden is a character set, it is used for finding the
+token borders.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-13 Filtering/Deleting
address@hidden Filtering/Deleting
+
address@hidden means to remove all characters from a string which do
+not match a given criteria, @dfn{deleting} means the opposite.
+
address@hidden primitive string-filter s char_pred [start end]
+Filter the string @var{s}, retaining only those characters that
+satisfy the @var{char_pred} argument.  If the argument is a
+procedure, it is applied to each character as a predicate, if
+it is a character, it is tested for equality and if it is a
+character set, it is tested for membership.
address@hidden deffn
+
address@hidden primitive string-delete s char_pred [start end]
+Filter the string @var{s}, retaining only those characters that
+do not satisfy the @var{char_pred} argument.  If the argument
+is a procedure, it is applied to each character as a predicate,
+if it is a character, it is tested for equality and if it is a
+character set, it is tested for membership.
address@hidden deffn
+
+
address@hidden SRFI-14
address@hidden SRFI-14 - Character-set Library
+
+SRFI-14 defines the data type @dfn{character set}, and also defines a
+lot of procedures for handling this character type, and a few standard
+character sets like whitespace, alphabetic characters and others.
+
+All procedures from SRFI-14 (character-set library) are implemented in
+the module @code{(srfi srfi-14)}, as well as the standard variables
address@hidden:letter}, @code{char-set:digit} etc.
+
address@hidden
+* Loading SRFI-14::             How to make charsets available.
+* SRFI-14 Character Set Data Type::  Underlying data type for charsets.
+* SRFI-14 Predicates/Comparison::  Charset predicates.
+* SRFI-14 Iterating Over Character Sets::  Enumerate charset elements.
+* SRFI-14 Creating Character Sets::  Makeing new charsets.
+* SRFI-14 Querying Character Sets::  Test charsets for membership etc.
+* SRFI-14 Character-Set Algebra::  Calculating new charsets.
+* SRFI-14 Standard Character Sets::  Variables containing predefined charsets.
address@hidden menu
+
+
address@hidden Loading SRFI-14
address@hidden Loading SRFI-14
+
+When Guile is properly installed, SRFI-14 support can be loaded into a
+running Guile by using the @code{(srfi srfi-14)} module.
+
address@hidden
+$ guile
+guile> (use-modules (srfi srfi-14))
+guile> (char-set-union (char-set #\f #\o #\o) (string->char-set "bar"))
+#<charset @{#\a #\b #\f #\o address@hidden>
+guile>
address@hidden example
+
+
address@hidden SRFI-14 Character Set Data Type
address@hidden Character Set Data Type
+
+The data type @dfn{charset} implements sets of characters (REFFIXME).
+Because the internal representation of character sets is not visible to
+the user, a lot of procedures for handling them are provided.
+
+Character sets can be created, extended, tested for the membership of a
+characters and be compared to other character sets.
+
+The Guile implementation of character sets deals with 8-bit characters.
+In the standard variables, only the ASCII part of the character range is
+really used, so that for example @dfn{Umlaute} and other accented
+characters are not considered to be letters.  In the future, as Guile
+may get support for international character sets, this will change, so
+don't rely on these ``features''.
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-14 Predicates/Comparison
address@hidden Predicates/Comparison
+
+Use these procedures for testing whether an object is a character set,
+or whether several character sets are equal or subsets of each other.
address@hidden can be used for calculating a hash value, maybe for
+usage in fast lookup procedures.
+
address@hidden primitive char-set? obj
+Return @code{#t} if @var{obj} is a character set, @code{#f}
+otherwise.
address@hidden deffn
+
address@hidden primitive char-set= cs1 @dots{}
+Return @code{#t} if all given character sets are equal.
address@hidden deffn
+
address@hidden primitive char-set<= cs1 @dots{}
+Return @code{#t} if every character set @var{cs}i is a subset
+of character set @var{cs}i+1.
address@hidden deffn
+
address@hidden primitive char-set-hash cs [bound]
+Compute a hash value for the character set @var{cs}.  If
address@hidden is given and not @code{#f}, it restricts the
+returned value to the range 0 @dots{} @var{bound - 1}.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-14 Iterating Over Character Sets
address@hidden Iterating Over Character Sets
+
+Character set cursors are a means for iterating over the members of a
+character sets.  After creating a character set cursor with
address@hidden, a cursor can be dereferenced with
address@hidden, advanced to the next member with
address@hidden  Whether a cursor has passed past the last
+element of the set can be checked with @code{end-of-char-set?}.
+
+Additionally, mapping and (un-)folding procedures for character sets are
+provided.
+
address@hidden primitive char-set-cursor cs
+Return a cursor into the character set @var{cs}.
address@hidden deffn
+
address@hidden primitive char-set-ref cs cursor
+Return the character at the current cursor position
address@hidden in the character set @var{cs}.  It is an error to
+pass a cursor for which @code{end-of-char-set?} returns true.
address@hidden deffn
+
address@hidden primitive char-set-cursor-next cs cursor
+Advance the character set cursor @var{cursor} to the next
+character in the character set @var{cs}.  It is an error if the
+cursor given satisfies @code{end-of-char-set?}.
address@hidden deffn
+
address@hidden primitive end-of-char-set? cursor
+Return @code{#t} if @var{cursor} has reached the end of a
+character set, @code{#f} otherwise.
address@hidden deffn
+
address@hidden primitive char-set-fold kons knil cs
+Fold the procedure @var{kons} over the character set @var{cs},
+initializing it with @var{knil}.
address@hidden deffn
+
address@hidden primitive char-set-unfold p f g seed [base_cs]
address@hidden primitive char-set-unfold! p f g seed base_cs
+This is a fundamental constructor for character sets.
address@hidden
address@hidden @var{g} is used to generate a series of ``seed'' values 
+from the initial seed: @var{seed}, (@var{g} @var{seed}),
+(@var{g}^2 @var{seed}), (@var{g}^3 @var{seed}), @dots{}
address@hidden @var{p} tells us when to stop -- when it returns true
+when applied to one of the seed values. 
address@hidden @var{f} maps each seed value to a character. These
+characters are added to the base character set @var{base_cs} to
+form the result; @var{base_cs} defaults to the empty set.
address@hidden itemize
+
address@hidden is the side-effecting variant.
address@hidden deffn
+
address@hidden primitive char-set-for-each proc cs
+Apply @var{proc} to every character in the character set
address@hidden  The return value is not specified.
address@hidden deffn
+
address@hidden primitive char-set-map proc cs
+Map the procedure @var{proc} over every character in @var{cs}.
address@hidden must be a character -> character procedure.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-14 Creating Character Sets
address@hidden Creating Character Sets
+
+New character sets are produced with these procedures.
+
address@hidden primitive char-set-copy cs
+Return a newly allocated character set containing all
+characters in @var{cs}.
address@hidden deffn
+
address@hidden primitive char-set char1 @dots{}
+Return a character set containing all given characters.
address@hidden deffn
+
address@hidden primitive list->char-set char_list [base_cs]
address@hidden primitive list->char-set! char_list base_cs
+Convert the character list @var{list} to a character set.  If
+the character set @var{base_cs} is given, the character in this
+set are also included in the result.
+
address@hidden>char-set!} is the side-effecting variant.
address@hidden deffn
+
address@hidden primitive string->char-set s [base_cs]
address@hidden primitive string->char-set! s base_cs
+Convert the string @var{str} to a character set.  If the
+character set @var{base_cs} is given, the characters in this
+set are also included in the result.
+
address@hidden>char-set!} is the side-effecting variant.
address@hidden deffn
+
address@hidden primitive char-set-filter pred cs [base_cs]
address@hidden primitive char-set-filter! pred cs base_cs
+Return a character set containing every character from @var{cs}
+so that it satisfies @var{pred}.  If provided, the characters
+from @var{base_cs} are added to the result.
+
address@hidden is the side-effecting variant.
address@hidden deffn
+
address@hidden primitive ucs-range->char-set lower upper [error? base_cs]
address@hidden primitive uce-range->char-set! lower upper error? base_cs
+Return a character set containing all characters whose
+character codes lie in the half-open range
address@hidden,@var{upper}).
+
+If @var{error} is a true value, an error is signalled if the
+specified range contains characters which are not contained in
+the implemented character range.  If @var{error} is @code{#f},
+these characters are silently left out of the resultung
+character set.
+
+The characters in @var{base_cs} are added to the result, if
+given.
+
address@hidden>char-set!} is the side-effecting variant.
address@hidden deffn
+
address@hidden procedure ->char-set x
+Coerce @var{x} into a character set.  @var{x} may be a string, a
+character or a character set.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-14 Querying Character Sets
address@hidden Querying Character Sets
+
+Access the elements and other information of a character set with these
+procedures.
+
address@hidden primitive char-set-size cs
+Return the number of elements in character set @var{cs}.
address@hidden deffn
+
address@hidden primitive char-set-count pred cs
+Return the number of the elements int the character set
address@hidden which satisfy the predicate @var{pred}.
address@hidden deffn
+
address@hidden primitive char-set->list cs
+Return a list containing the elements of the character set
address@hidden
address@hidden deffn
+
address@hidden primitive char-set->string cs
+Return a string containing the elements of the character set
address@hidden  The order in which the characters are placed in the
+string is not defined.
address@hidden deffn
+
address@hidden primitive char-set-contains? cs char
+Return @code{#t} iff the character @var{ch} is contained in the
+character set @var{cs}.
address@hidden deffn
+
address@hidden primitive char-set-every pred cs
+Return a true value if every character in the character set
address@hidden satisfies the predicate @var{pred}.
address@hidden deffn
+
address@hidden primitive char-set-any pred cs
+Return a true value if any character in the character set
address@hidden satisfies the predicate @var{pred}.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-14 Character-Set Algebra
address@hidden Character-Set Algebra
+
+Character sets can be manipulated with the common set algebra operation,
+such as union, complement, intersection etc.  All of these procedures
+provide side--effecting variants, which modify their character set
+argument(s).
+
address@hidden primitive char-set-adjoin cs char1 @dots{}
address@hidden primitive char-set-adjoin! cs char1 @dots{}
+Add all character arguments to the first argument, which must
+be a character set.
address@hidden deffn
+
address@hidden primitive char-set-delete cs char1 @dots{}
address@hidden primitive char-set-delete! cs char1 @dots{}
+Delete all character arguments from the first argument, which
+must be a character set.
address@hidden deffn
+
address@hidden primitive char-set-complement cs
address@hidden primitive char-set-complement! cs
+Return the complement of the character set @var{cs}.
address@hidden deffn
+
address@hidden primitive char-set-union cs1 @dots{}
address@hidden primitive char-set-union! cs1 @dots{}
+Return the union of all argument character sets.
address@hidden deffn
+
address@hidden primitive char-set-intersection cs1 @dots{}
address@hidden primitive char-set-intersection! cs1 @dots{}
+Return the intersection of all argument character sets.
address@hidden deffn
+
address@hidden primitive char-set-difference cs1 @dots{}
address@hidden primitive char-set-difference! cs1 @dots{}
+Return the difference of all argument character sets.
address@hidden deffn
+
address@hidden primitive char-set-xor cs1 @dots{}
address@hidden primitive char-set-xor! cs1 @dots{}
+Return the exclusive--or of all argument character sets.
address@hidden deffn
+
address@hidden primitive char-set-diff+intersection cs1 @dots{}
address@hidden primitive char-set-diff+intersection! cs1 @dots{}
+Return the difference and the intersection of all argument
+character sets.
address@hidden deffn
+
+
address@hidden 
===================================================================
+
address@hidden SRFI-14 Standard Character Sets
address@hidden Standard Character Sets
+
+In order to make the use of the character set data type and procedures
+useful, several predefined character set variables exist.
+
address@hidden char-set:lower-case
+All lower--case characters.
address@hidden defvar
+
address@hidden char-set:upper-case
+All upper--case characters.
address@hidden defvar
+
address@hidden char-set:title-case
+This is empty, because ASCII has no titlecase characters.
address@hidden defvar
+
address@hidden char-set:letter
+All letters, e.g. the union of @code{char-set:lower-case} and
address@hidden:upper-case}.
address@hidden defvar
+
address@hidden char-set:digit
+All digits.
address@hidden defvar
+
address@hidden char-set:letter+digit
+The union of @code{char-set:letter} and @code{char-set:digit}.
address@hidden defvar
+
address@hidden char-set:graphic
+All characters which would put ink on the paper.
address@hidden defvar
+
address@hidden char-set:printing
+The union of @code{char-set:graphic} and @code{char-set:whitespace}.
address@hidden defvar
+
address@hidden char-set:whitespace
+All whitespace characters.
address@hidden defvar
+
address@hidden char-set:blank
+All horizontal whitespace characters, that is @code{#\space} and
address@hidden
address@hidden defvar
+
address@hidden char-set:iso-control
+The ISO control characters with the codes 0--31 and 127.
address@hidden defvar
+
address@hidden char-set:punctuation
+The characters @code{!"#%&'()*,-./:;?@@address@hidden@}}
address@hidden defvar
+
address@hidden char-set:symbol
+The characters @code{$+<=>^`|~}.
address@hidden defvar
+
address@hidden char-set:hex-digit
+The hexadecimal digits @code{0123456789abcdefABCDEF}.
address@hidden defvar
+
address@hidden char-set:ascii
+All ASCII characters.
address@hidden defvar
+
address@hidden char-set:empty
+The empty character set.
address@hidden defvar
+
address@hidden char-set:full
+This character set contains all possible characters.
address@hidden defvar
+
address@hidden SRFI-16
address@hidden SRFI-16 - case-lambda
+
address@hidden FIXME::martin: Review me!
+
+The syntactic form @code{case-lambda} creates procedures, just like
address@hidden, but has syntactic extensions for writing procedures of
+varying arity easier.
+
+The syntax of the @code{case-lambda} form is defined in the following
+EBNF grammar.
+
address@hidden
+<case-lambda>
+   --> (case-lambda <case-lambda-clause>)
+<case-lambda-clause>
+   --> (<formals> <definition-or-command>*)
+<formals>
+   --> (<identifier>*)
+     | (<identifier>* . <identifier>)
+     | <identifier>
address@hidden example
+
+The value returned by a @code{case-lambda} form is a procedure which
+matches the number of actual arguments against the formals in the
+various clauses, in order.  @dfn{Formals} means a formal argument list
+just like with @code{lambda} (REFFIXME). The first matching clause is
+selected, the corresponding values from the actual parameter list are
+bound to the variable names in the clauses and the body of the clause is
+evaluated.  If no clause matches, an error is signalled.
+
+The following (silly) definition creates a procedure @var{foo} which
+acts differently, depending on the number of actual arguments.  If one
+argument is given, the constant @code{#t} is returned, two arguments are
+added and if more arguments are passed, their product is calculated.
+
address@hidden
+(define foo (case-lambda
+              ((x) #t)
+              ((x y) (+ x y))
+              (z
+                (apply * z))))
+(foo 'bar)
address@hidden
+#t
+(foo 2 4)
address@hidden
+6
+(foo 3 3 3)
address@hidden
+27
+(foo)
address@hidden
+1
address@hidden lisp
+
+The last expression evaluates to 1 because the last clause is matched,
address@hidden is bound to the empty list and the following multiplication,
+applied to zero arguments, yields 1.
+
+
 @node SRFI-17
address@hidden SRFI-17 -- Generalized set!
address@hidden SRFI-17 - Generalized set!
 
 This is an implementation of SRFI-17: Generalized set!
 



reply via email to

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