diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:34 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:34 -0800 |
commit | 237c6e380aebdcbc70bd1c9ecf7d3f6effca2752 (patch) | |
tree | 9832fbdd6fbeedf3fc7f0e7923fe20b7d35b1499 /slib.texi | |
parent | 5145dd3aa0c02c9fc496d1432fc4410674206e1d (diff) | |
download | slib-237c6e380aebdcbc70bd1c9ecf7d3f6effca2752.tar.gz slib-237c6e380aebdcbc70bd1c9ecf7d3f6effca2752.zip |
Import Upstream version 3a3upstream/3a3
Diffstat (limited to 'slib.texi')
-rw-r--r-- | slib.texi | 218 |
1 files changed, 168 insertions, 50 deletions
@@ -412,11 +412,11 @@ installation to installation, SLIB builds a separate catalog for each implementation it is used with. @noindent -The definition of @code{*SLIB-VERSION*} in SLIB file +The definition of @code{*slib-version*} in SLIB file @file{require.scm} is checked against the catalog association of -@code{*SLIB-VERSION*} to ascertain when versions have changed. It is +@code{*slib-version*} to ascertain when versions have changed. It is a reasonable practice to change the definition of -@code{*SLIB-VERSION*} whenever the library is changed. If multiple +@code{*slib-version*} whenever the library is changed. If multiple implementations of Scheme use SLIB, remember that recompiling one @file{slibcat} will update only that implementation's catalog. @@ -1183,7 +1183,11 @@ Returns the last pair in the list @var{l}. Example: Syntax extensions (macros) included with SLIB. * Define-Structure:: 'structure +* Define-Record-Type:: 'define-record-type, 'srfi-9 * Fluid-Let:: 'fluid-let +* Binding to multiple values:: 'receive, 'srfi-8 +* Guarded LET* special form:: 'and-let*, 'srfi-2 +* Guarded COND Clause:: 'guarded-cond-clause, 'srfi-61 * Yasos:: 'yasos, 'oop, 'collect @end menu @@ -2132,7 +2136,7 @@ Send bug reports, comments, suggestions, and questions to Kent Dybvig -@node Define-Structure, Fluid-Let, Syntax-Case Macros, Scheme Syntax Extension Packages +@node Define-Structure, Define-Record-Type, Syntax-Case Macros, Scheme Syntax Extension Packages @section Define-Structure @code{(require 'structure)} @@ -2195,8 +2199,30 @@ red @end deffn +@node Define-Record-Type, Fluid-Let, Define-Structure, Scheme Syntax Extension Packages +@section Define-Record-Type -@node Fluid-Let, Yasos, Define-Structure, Scheme Syntax Extension Packages +@code{(require 'define-record-type)} or @code{(require 'srfi-9)} +@ftindex srfi-9 +@ftindex define-record-type + +@url{http://srfi.schemers.org/srfi-9/srfi-9.html} + +@defspec define-record-type <type-name> (<constructor-name> <field-tag> ...) <predicate-name> <field-spec> ... + +Where +@lisp +<field-spec> @equiv{} (<field-tag> <accessor-name>) + @equiv{} (<field-tag> <accessor-name> <modifier-name>) + +@end lisp + +@code{define-record-type} is a syntax wrapper for the SLIB +@code{record} module. +@end defspec + + +@node Fluid-Let, Binding to multiple values, Define-Record-Type, Scheme Syntax Extension Packages @section Fluid-Let @code{(require 'fluid-let)} @@ -2224,7 +2250,107 @@ by the rules of lexical scoping) of its corresponding @var{variable}. -@node Yasos, , Fluid-Let, Scheme Syntax Extension Packages +@node Binding to multiple values, Guarded LET* special form, Fluid-Let, Scheme Syntax Extension Packages +@section Binding to multiple values + +@code{(require 'receive)} or @code{(require 'srfi-8)} +@ftindex srfi-8 +@ftindex receive + +@defspec receive formals expression body @dots{} + +@url{http://srfi.schemers.org/srfi-8/srfi-8.html} +@end defspec + + + +@node Guarded LET* special form, Guarded COND Clause, Binding to multiple values, Scheme Syntax Extension Packages +@section Guarded LET* special form + +@code{(require 'and-let*)} or @code{(require 'srfi-2)} +@ftindex srfi-2 +@ftindex and-let* + +@defmac and-let* claws body @dots{} + +@url{http://srfi.schemers.org/srfi-2/srfi-2.html} +@end defmac + + +@node Guarded COND Clause, Yasos, Guarded LET* special form, Scheme Syntax Extension Packages +@section Guarded COND Clause + +@code{(require 'guarded-cond-clause)} or @code{(require 'srfi-61)} +@ftindex srfi-61 +@ftindex guarded-cond-clause + +@url{http://srfi.schemers.org/srfi-61/srfi-61.html} + +@deffn {library syntax} cond <clause1> <clause2> @dots{} + +@emph{Syntax:} +Each @r{<clause>} should be of the form + +@format +@t{(@r{<test>} @r{<expression1>} @dots{}) +} +@end format + +where @r{<test>} is any expression. Alternatively, a @r{<clause>} may be +of the form + +@format +@t{(@r{<test>} => @r{<expression>}) +} +@end format + +The @r{<clause>} production in the formal syntax of Scheme as +written by R5RS in section 7.1.3 is extended with a new option: +@cindex @w{=>} + +@format +@t{@r{<clause>} => (@r{<generator>} @r{<guard>} => @r{<receiver>}) +} +@end format + +where @r{<generator>}, @r{<guard>}, & @r{<receiver>} are all +@r{<expression>}s. + +@quotation +Clauses of this form have the following semantics: @r{<generator>} is +evaluated. It may return arbitrarily many values. @r{<Guard>} is +applied to an argument list containing the values in order that +@r{<generator>} returned. If @r{<guard>} returns a true value for +that argument list, @r{<receiver>} is applied with an equivalent +argument list. If @r{<guard>} returns a false value, however, the +clause is abandoned and the next one is tried. +@end quotation + +The last @r{<clause>} may be +an ``else clause,'' which has the form + +@format +@t{(else @r{<expression1>} @r{<expression2>} @dots{})@r{.} +} +@end format +@end deffn + +@noindent +This @code{port->char-list} procedure accepts an input port and +returns a list of all the characters it produces until the end. + +@example +(define (port->char-list port) + (cond ((read-char port) char? + => (lambda (c) (cons c (port->char-list port)))) + (else '()))) + +(call-with-input-string "foo" port->char-list) ==> (#\f #\o #\o) +@end example + + + +@node Yasos, , Guarded COND Clause, Scheme Syntax Extension Packages @section Yasos @c Much of the documentation in this section was written by Dave Love @@ -2516,6 +2642,8 @@ value is unspecified. @result{} 2 @end lisp + + @node Textual Conversion Packages, Mathematical Packages, Scheme Syntax Extension Packages, Top @chapter Textual Conversion Packages @@ -4698,6 +4826,7 @@ match the arguments to @code{encode-universal-time}. * Color:: * Root Finding:: 'root * Minimizing:: 'minimize +* The Limit:: 'limit * Commutative Rings:: 'commutative-ring * Matrix Algebra:: 'determinant @end menu @@ -6183,6 +6312,11 @@ Resene Paints Ltd. @code{(require 'root)} @ftindex root +@defun integer-sqrt y +Given a non-negative integer @var{y}, returns the largest integer +whose square is less than or equal to @var{y}. +@end defun + @defun newton:find-integer-root f df/dx x0 Given integer valued procedure @var{f}, its derivative (with respect to its argument) @var{df/dx}, and initial integer value @var{x0} for which @@ -6203,11 +6337,6 @@ To find the closest integer to a given integer's square root: @end example @end defun -@defun integer-sqrt y -Given a non-negative integer @var{y}, returns the rounded square-root of -@var{y}. -@end defun - @defun newton:find-root f df/dx x0 prec Given real valued procedures @var{f}, @var{df/dx} of one (real) argument, initial real value @var{x0} for which @var{df/dx}(@var{x0}) is @@ -6287,7 +6416,7 @@ iterations performed so far. @var{prec} should return non-false if the iteration should be stopped. @end defun -@node Minimizing, Commutative Rings, Root Finding, Mathematical Packages +@node Minimizing, The Limit, Root Finding, Mathematical Packages @section Minimizing @code{(require 'minimize)} @@ -6296,7 +6425,13 @@ if the iteration should be stopped. @include minimize.txi -@node Commutative Rings, Matrix Algebra, Minimizing, Mathematical Packages +@node The Limit, Commutative Rings, Minimizing, Mathematical Packages +@section The Limit + +@include limit.texi + + +@node Commutative Rings, Matrix Algebra, The Limit, Mathematical Packages @section Commutative Rings Scheme provides a consistent and capable set of numeric functions. @@ -8835,6 +8970,7 @@ operation is equivalent to * Arrays:: 'array * Subarrays:: 'subarray * Array Mapping:: 'array-for-each +* Array Interpolation:: 'array-interpolate * Association Lists:: 'alist * Byte:: 'byte * Byte/Number Conversions:: 'byte-number @@ -8864,13 +9000,19 @@ operation is equivalent to @include subarray.txi -@node Array Mapping, Association Lists, Subarrays, Data Structures +@node Array Mapping, Array Interpolation, Subarrays, Data Structures @subsection Array Mapping @include arraymap.txi -@node Association Lists, Byte, Array Mapping, Data Structures +@node Array Interpolation, Association Lists, Array Mapping, Data Structures +@subsection Array Interpolation + +@include linterp.txi + + +@node Association Lists, Byte, Array Interpolation, Data Structures @subsection Association Lists @include alist.txi @@ -11234,48 +11376,24 @@ unspecified. @menu * SRFI-1:: list-processing -* SRFI-2:: guarded LET* special form -* SRFI-8:: Binding to multiple values -* SRFI-9:: Defining Record Types @end menu -SRFI-47 is the same as @ref{Arrays}. +@itemize @bullet +@item SRFI-2 @ref{Guarded LET* special form} +@item SRFI-8 @ref{Binding to multiple values} +@item SRFI-9 @ref{Define-Record-Type} +@item SRFI-47 @ref{Arrays} +@item SRFI-59 @ref{Vicinity} +@item SRFI-63 @ref{Arrays} +@item SRFI-60 @ref{Bit-Twiddling} +@item SRFI-61 @ref{Guarded COND Clause} +@end itemize -@node SRFI-1, SRFI-2, SRFI, SRFI +@node SRFI-1, , SRFI, SRFI @subsubsection SRFI-1 @include srfi-1.txi -@node SRFI-2, SRFI-8, SRFI-1, SRFI -@subsubsection SRFI-2 - -@include srfi-2.txi - -@node SRFI-8, SRFI-9, SRFI-2, SRFI -@subsubsection SRFI-8 - -@include srfi-8.txi - -@node SRFI-9, , SRFI-8, SRFI -@subsubsection SRFI-9 - -@code{(require 'srfi-9)} -@ftindex srfi-9 - -@url{http://srfi.schemers.org/srfi-9/srfi-9.html} - -@defspec define-record-type <type-name> (<constructor-name> <field-tag> ...) <predicate-name> <field spec> ... - -Where -@lisp -<field-spec> @equiv{} (<field-tag> <accessor-name>) - @equiv{} (<field-tag> <accessor-name> <modifier-name>) - -@end lisp - -@code{define-record-type} is a syntax wrapper for the SLIB -@code{record} module. -@end defspec @node Session Support, System Interface, Standards Support, Other Packages |