mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 22:10:21 +02:00
* Change R4RS references to R5RS.
This commit is contained in:
parent
63f412c209
commit
8c34cf5b14
11 changed files with 37 additions and 750 deletions
|
@ -1,5 +1,18 @@
|
|||
2001-04-22 Neil Jerram <neil@ossau.uklinux.net>
|
||||
|
||||
* scheme-io.texi: Remove old docstring comments referring to
|
||||
r4rs.scm.
|
||||
|
||||
* appendices.texi (The Basic Guile Package, Packages not shipped
|
||||
with Guile), env.texi (Switching to Environments), format.texi
|
||||
(Format Specification), gh.texi
|
||||
(Executing Scheme code, Calling Scheme procedures from C),
|
||||
guile-tut.texi (How to characterize Guile), scheme-data.texi
|
||||
(Symbols, Keywords, Keyword Read Syntax, Append/Reverse),
|
||||
scheme-evaluation.texi (Delayed Evaluation), scheme-modules.texi
|
||||
(Scheme and modules), scheme-io.texi (Soft Ports): Change R4RS
|
||||
references to R5RS.
|
||||
|
||||
* r4rs.texi: Removed.
|
||||
|
||||
* Makefile.am (info_TEXINFOS): Remove r4rs.
|
||||
|
|
|
@ -1,279 +0,0 @@
|
|||
@node Obtaining and Installing Guile
|
||||
@appendix Obtaining and Installing Guile
|
||||
|
||||
Here is the information you will need to get and install Guile and extra
|
||||
packages and documentation you might need or find interesting.
|
||||
|
||||
@menu
|
||||
* The Basic Guile Package::
|
||||
* Packages not shipped with Guile::
|
||||
@end menu
|
||||
|
||||
@node The Basic Guile Package
|
||||
@section The Basic Guile Package
|
||||
|
||||
Guile can be obtained from the main GNU archive site
|
||||
@url{ftp://prep.ai.mit.edu/pub/gnu} or any of its mirrors. The file
|
||||
will be named guile-version.tar.gz. The current version is
|
||||
@value{VERSION}, so the file you should grab is:
|
||||
|
||||
@url{ftp://prep.ai.mit.edu/pub/gnu/guile-@value{VERSION}.tar.gz}
|
||||
|
||||
To unbundle Guile use the instruction
|
||||
@example
|
||||
zcat guile-@value{VERSION}.tar.gz | tar xvf -
|
||||
@end example
|
||||
which will create a directory called @file{guile-@value{VERSION}} with
|
||||
all the sources. You can look at the file @file{INSTALL} for detailed
|
||||
instructions on how to build and install Guile, but you should be able
|
||||
to just do
|
||||
@example
|
||||
cd guile-@value{VERSION}
|
||||
./configure
|
||||
make install
|
||||
@end example
|
||||
|
||||
This will install the Guile executable @file{guile}, the Guile library
|
||||
@file{libguile.a} and various associated header files and support
|
||||
libraries. It will also install the Guile tutorial and reference manual.
|
||||
|
||||
@c [[include instructions for getting R4RS]]
|
||||
|
||||
Since this manual frequently refers to the Scheme ``standard'', also
|
||||
known as R4RS, or the
|
||||
@iftex
|
||||
``Revised$^4$ Report on the Algorithmic Language Scheme'',
|
||||
@end iftex
|
||||
@ifinfo
|
||||
``Revised^4 Report on the Algorithmic Language Scheme'',
|
||||
@end ifinfo
|
||||
we have included the report in the Guile distribution;
|
||||
@xref{Top, , Introduction, r4rs, Revised(4) Report on the Algorithmic
|
||||
Language Scheme}.
|
||||
This will also be installed in your info directory.
|
||||
|
||||
|
||||
@node Packages not shipped with Guile
|
||||
@section Packages not shipped with Guile
|
||||
|
||||
We ship the Guile tutorial and reference manual with the Guile
|
||||
distribution [FIXME: this is not currently true (Sat Sep 20 14:13:33 MDT
|
||||
1997), but will be soon.] Since the Scheme standard (R4RS) is a stable
|
||||
document, we ship that too.
|
||||
|
||||
Here are references (usually World Wide Web URLs) to some other freely
|
||||
redistributable documents and packages which you might find useful if
|
||||
you are using Guile.
|
||||
|
||||
@table @strong
|
||||
@item SCSH
|
||||
the Scheme Shell. Gary Houston has ported SCSH to Guile. The relevant
|
||||
chapter (@pxref{The Scheme shell (scsh)}) has references to the SCSH web
|
||||
page with all its documentation.
|
||||
|
||||
@item SLIB
|
||||
a portable Scheme library maintained by Aubrey Jaffer. SLIB can be
|
||||
obtained by ftp from @url{ftp://prep.ai.mit.edu/pub/gnu/jacal/}.
|
||||
|
||||
The SLIB package should be unpacked somewhere in Guile's load path. It
|
||||
will typically be unpacked in @file{/usr/local/share/guile/site}, so
|
||||
that it will be @file{/usr/local/share/guile/site/slib}.
|
||||
|
||||
Guile might have been installed with a different prefix, in which case
|
||||
the load path can be checked from inside the interpreter with:
|
||||
|
||||
@smalllisp
|
||||
guile> %load-path
|
||||
("/usr/local/share/guile/site" "/usr/local/share/guile/1.3a" "/usr/local/share/guile" ".")
|
||||
@end smalllisp
|
||||
|
||||
The relevant chapter (@pxref{SLIB}) has details on how to use SLIB with
|
||||
Guile.
|
||||
|
||||
@item JACAL
|
||||
a symbolic math package by Aubrey Jaffer. The latest version of Jacal
|
||||
can be obtained from @url{ftp://prep.ai.mit.edu/pub/gnu/jacal/}, and
|
||||
should be unpacked in @file{/usr/local/share/guile/site/slib} so that
|
||||
it will be in @file{/usr/local/share/guile/site/slib/jacal}.
|
||||
|
||||
The relevant section (@pxref{JACAL}) has details on how to use Jacal.
|
||||
@end table
|
||||
|
||||
|
||||
@page
|
||||
@node Debugger User Interface
|
||||
@appendix Debugger User Interface
|
||||
|
||||
@c --- The title and introduction of this appendix need to
|
||||
@c distinguish this clearly from the chapter on the internal
|
||||
@c debugging interface.
|
||||
|
||||
When debugging a program, programmers often find it helpful to examine
|
||||
the program's internal status while it runs: the values of internal
|
||||
variables, the choices made in @code{if} and @code{cond} statements, and
|
||||
so forth. Guile Scheme provides a debugging interface that programmers
|
||||
can use to single-step through Scheme functions and examine symbol
|
||||
bindings. This is different from the @ref{Debugging}, which permits
|
||||
programmers to debug the Guile interpreter itself. Most programmers
|
||||
will be more interested in debugging their own Scheme programs than the
|
||||
interpreter which evaluates them.
|
||||
|
||||
[FIXME: should we include examples of traditional debuggers
|
||||
and explain why they can't be used to debug interpreted Scheme or Lisp?]
|
||||
|
||||
@menu
|
||||
* Single-Step:: Execute a program or function one step at a time.
|
||||
* Trace:: Print a report each time a given function is called.
|
||||
* Backtrace:: See a list of the statements that caused an error.
|
||||
* Stacks and Frames:: Examine the state of an interrupted program.
|
||||
@end menu
|
||||
|
||||
@node Single-Step
|
||||
@appendixsec Single-Step
|
||||
|
||||
@node Trace
|
||||
@appendixsec Trace
|
||||
|
||||
When a function is @dfn{traced}, it means that every call to that
|
||||
function is reported to the user during a program run. This can help a
|
||||
programmer determine whether a function is being called at the wrong
|
||||
time or with the wrong set of arguments.
|
||||
|
||||
@defun trace function
|
||||
Enable debug tracing on @code{function}. While a program is being run, Guile
|
||||
will print a brief report at each call to a traced function,
|
||||
advising the user which function was called and the arguments that were
|
||||
passed to it.
|
||||
@end defun
|
||||
|
||||
@defun untrace function
|
||||
Disable debug tracing for @code{function}.
|
||||
@end defun
|
||||
|
||||
Example:
|
||||
|
||||
@lisp
|
||||
(define (rev ls)
|
||||
(if (null? ls)
|
||||
'()
|
||||
(append (rev (cdr ls))
|
||||
(cons (car ls) '())))) @result{} rev
|
||||
|
||||
(trace rev) @result{} (rev)
|
||||
|
||||
(rev '(a b c d e))
|
||||
@result{} [rev (a b c d e)]
|
||||
| [rev (b c d e)]
|
||||
| | [rev (c d e)]
|
||||
| | | [rev (d e)]
|
||||
| | | | [rev (e)]
|
||||
| | | | | [rev ()]
|
||||
| | | | | ()
|
||||
| | | | (e)
|
||||
| | | (e d)
|
||||
| | (e d c)
|
||||
| (e d c b)
|
||||
(e d c b a)
|
||||
(e d c b a)
|
||||
@end lisp
|
||||
|
||||
Note the way Guile indents the output, illustrating the depth of
|
||||
execution at each function call. This can be used to demonstrate, for
|
||||
example, that Guile implements self-tail-recursion properly:
|
||||
|
||||
@lisp
|
||||
(define (rev ls sl)
|
||||
(if (null? ls)
|
||||
sl
|
||||
(rev (cdr ls)
|
||||
(cons (car ls) sl)))) @result{} rev
|
||||
|
||||
(trace rev) @result{} (rev)
|
||||
|
||||
(rev '(a b c d e) '())
|
||||
@result{} [rev (a b c d e) ()]
|
||||
[rev (b c d e) (a)]
|
||||
[rev (c d e) (b a)]
|
||||
[rev (d e) (c b a)]
|
||||
[rev (e) (d c b a)]
|
||||
[rev () (e d c b a)]
|
||||
(e d c b a)
|
||||
(e d c b a)
|
||||
@end lisp
|
||||
|
||||
Since the tail call is effectively optimized to a @code{goto} statement,
|
||||
there is no need for Guile to create a new stack frame for each
|
||||
iteration. Using @code{trace} here helps us see why this is so.
|
||||
|
||||
@node Backtrace
|
||||
@appendixsec Backtrace
|
||||
|
||||
@node Stacks and Frames
|
||||
@appendixsec Stacks and Frames
|
||||
|
||||
When a running program is interrupted, usually upon reaching an error or
|
||||
breakpoint, its state is represented by a @dfn{stack} of suspended
|
||||
function calls, each of which is called a @dfn{frame}. The programmer
|
||||
can learn more about the program's state at the point of interruption by
|
||||
inspecting and modifying these frames.
|
||||
|
||||
@deffn primitive stack? obj
|
||||
Return @code{#t} if @var{obj} is a calling stack.
|
||||
@end deffn
|
||||
|
||||
@deffn primitive make-stack
|
||||
@end deffn
|
||||
|
||||
@deffn syntax start-stack id exp
|
||||
Evaluate @var{exp} on a new calling stack with identity @var{id}. If
|
||||
@var{exp} is interrupted during evaluation, backtraces will not display
|
||||
frames farther back than @var{exp}'s top-level form. This macro is a
|
||||
way of artificially limiting backtraces and stack procedures, largely as
|
||||
a convenience to the user.
|
||||
@end deffn
|
||||
|
||||
@deffn primitive stack-id stack
|
||||
Return the identifier given to @var{stack} by @code{start-stack}.
|
||||
@end deffn
|
||||
|
||||
@deffn primitive stack-ref
|
||||
@end deffn
|
||||
|
||||
@deffn primitive stack-length
|
||||
@end deffn
|
||||
|
||||
@deffn primitive frame?
|
||||
@end deffn
|
||||
|
||||
@deffn primitive last-stack-frame
|
||||
@end deffn
|
||||
|
||||
@deffn primitive frame-number
|
||||
@end deffn
|
||||
|
||||
@deffn primitive frame-source
|
||||
@end deffn
|
||||
|
||||
@deffn primitive frame-procedure
|
||||
@end deffn
|
||||
|
||||
@deffn primitive frame-arguments
|
||||
@end deffn
|
||||
|
||||
@deffn primitive frame-previous
|
||||
@end deffn
|
||||
|
||||
@deffn primitive frame-next
|
||||
@end deffn
|
||||
|
||||
@deffn primitive frame-real?
|
||||
@end deffn
|
||||
|
||||
@deffn primitive frame-procedure?
|
||||
@end deffn
|
||||
|
||||
@deffn primitive frame-evaluating-args?
|
||||
@end deffn
|
||||
|
||||
@deffn primitive frame-overflow
|
||||
@end deffn
|
|
@ -47,7 +47,7 @@ Copyright @copyright{} 1999 Free Software Foundation, Inc.
|
|||
@chapter Motivation
|
||||
|
||||
@example
|
||||
$Id: env.texi,v 1.1 2001-03-09 08:21:59 ossau Exp $
|
||||
$Id: env.texi,v 1.2 2001-04-22 14:56:52 ossau Exp $
|
||||
@end example
|
||||
|
||||
This is a draft proposal for a new datatype for representing top-level
|
||||
|
@ -1053,7 +1053,7 @@ interact with, perhaps with some limitations.
|
|||
|
||||
@item
|
||||
For testing purposes, make an utterly minimal version of
|
||||
@file{boot-9.scm}: no module system, no R4RS, nothing. I think a simple
|
||||
@file{boot-9.scm}: no module system, no R5RS, nothing. I think a simple
|
||||
REPL is all we need.
|
||||
|
||||
@item
|
||||
|
|
434
doc/format.texi
434
doc/format.texi
|
@ -1,434 +0,0 @@
|
|||
|
||||
@menu
|
||||
* Format Interface::
|
||||
* Format Specification::
|
||||
@end menu
|
||||
|
||||
@node Format Interface, Format Specification, Format, Format
|
||||
@subsection Format Interface
|
||||
|
||||
@defun format destination format-string . arguments
|
||||
An almost complete implementation of Common LISP format description
|
||||
according to the CL reference book @cite{Common LISP} from Guy L.
|
||||
Steele, Digital Press. Backward compatible to most of the available
|
||||
Scheme format implementations.
|
||||
|
||||
Returns @code{#t}, @code{#f} or a string; has side effect of printing
|
||||
according to @var{format-string}. If @var{destination} is @code{#t},
|
||||
the output is to the current output port and @code{#t} is returned. If
|
||||
@var{destination} is @code{#f}, a formatted string is returned as the
|
||||
result of the call. NEW: If @var{destination} is a string,
|
||||
@var{destination} is regarded as the format string; @var{format-string} is
|
||||
then the first argument and the output is returned as a string. If
|
||||
@var{destination} is a number, the output is to the current error port
|
||||
if available by the implementation. Otherwise @var{destination} must be
|
||||
an output port and @code{#t} is returned.@refill
|
||||
|
||||
@var{format-string} must be a string. In case of a formatting error
|
||||
format returns @code{#f} and prints a message on the current output or
|
||||
error port. Characters are output as if the string were output by the
|
||||
@code{display} function with the exception of those prefixed by a tilde
|
||||
(~). For a detailed description of the @var{format-string} syntax
|
||||
please consult a Common LISP format reference manual. For a test suite
|
||||
to verify this format implementation load @file{formatst.scm}. Please
|
||||
send bug reports to @code{lutzeb@@cs.tu-berlin.de}.
|
||||
|
||||
Note: @code{format} is not reentrant, i.e. only one @code{format}-call
|
||||
may be executed at a time.
|
||||
|
||||
@end defun
|
||||
|
||||
@node Format Specification, , Format Interface, Format
|
||||
@subsection Format Specification (Format version 3.0)
|
||||
|
||||
Please consult a Common LISP format reference manual for a detailed
|
||||
description of the format string syntax. For a demonstration of the
|
||||
implemented directives see @file{formatst.scm}.@refill
|
||||
|
||||
This implementation supports directive parameters and modifiers
|
||||
(@code{:} and @code{@@} characters). Multiple parameters must be
|
||||
separated by a comma (@code{,}). Parameters can be numerical parameters
|
||||
(positive or negative), character parameters (prefixed by a quote
|
||||
character (@code{'}), variable parameters (@code{v}), number of rest
|
||||
arguments parameter (@code{#}), empty and default parameters. Directive
|
||||
characters are case independent. The general form of a directive
|
||||
is:@refill
|
||||
|
||||
@noindent
|
||||
@var{directive} ::= ~@{@var{directive-parameter},@}[:][@@]@var{directive-character}
|
||||
|
||||
@noindent
|
||||
@var{directive-parameter} ::= [ [-|+]@{0-9@}+ | '@var{character} | v | # ]
|
||||
|
||||
|
||||
@subsubsection Implemented CL Format Control Directives
|
||||
|
||||
Documentation syntax: Uppercase characters represent the corresponding
|
||||
control directive characters. Lowercase characters represent control
|
||||
directive parameter descriptions.
|
||||
|
||||
@table @asis
|
||||
@item @code{~A}
|
||||
Any (print as @code{display} does).
|
||||
@table @asis
|
||||
@item @code{~@@A}
|
||||
left pad.
|
||||
@item @code{~@var{mincol},@var{colinc},@var{minpad},@var{padchar}A}
|
||||
full padding.
|
||||
@end table
|
||||
@item @code{~S}
|
||||
S-expression (print as @code{write} does).
|
||||
@table @asis
|
||||
@item @code{~@@S}
|
||||
left pad.
|
||||
@item @code{~@var{mincol},@var{colinc},@var{minpad},@var{padchar}S}
|
||||
full padding.
|
||||
@end table
|
||||
@item @code{~D}
|
||||
Decimal.
|
||||
@table @asis
|
||||
@item @code{~@@D}
|
||||
print number sign always.
|
||||
@item @code{~:D}
|
||||
print comma separated.
|
||||
@item @code{~@var{mincol},@var{padchar},@var{commachar}D}
|
||||
padding.
|
||||
@end table
|
||||
@item @code{~X}
|
||||
Hexadecimal.
|
||||
@table @asis
|
||||
@item @code{~@@X}
|
||||
print number sign always.
|
||||
@item @code{~:X}
|
||||
print comma separated.
|
||||
@item @code{~@var{mincol},@var{padchar},@var{commachar}X}
|
||||
padding.
|
||||
@end table
|
||||
@item @code{~O}
|
||||
Octal.
|
||||
@table @asis
|
||||
@item @code{~@@O}
|
||||
print number sign always.
|
||||
@item @code{~:O}
|
||||
print comma separated.
|
||||
@item @code{~@var{mincol},@var{padchar},@var{commachar}O}
|
||||
padding.
|
||||
@end table
|
||||
@item @code{~B}
|
||||
Binary.
|
||||
@table @asis
|
||||
@item @code{~@@B}
|
||||
print number sign always.
|
||||
@item @code{~:B}
|
||||
print comma separated.
|
||||
@item @code{~@var{mincol},@var{padchar},@var{commachar}B}
|
||||
padding.
|
||||
@end table
|
||||
@item @code{~@var{n}R}
|
||||
Radix @var{n}.
|
||||
@table @asis
|
||||
@item @code{~@var{n},@var{mincol},@var{padchar},@var{commachar}R}
|
||||
padding.
|
||||
@end table
|
||||
@item @code{~@@R}
|
||||
print a number as a Roman numeral.
|
||||
@item @code{~:@@R}
|
||||
print a number as an ``old fashioned'' Roman numeral.
|
||||
@item @code{~:R}
|
||||
print a number as an ordinal English number.
|
||||
@item @code{~:@@R}
|
||||
print a number as a cardinal English number.
|
||||
@item @code{~P}
|
||||
Plural.
|
||||
@table @asis
|
||||
@item @code{~@@P}
|
||||
prints @code{y} and @code{ies}.
|
||||
@item @code{~:P}
|
||||
as @code{~P but jumps 1 argument backward.}
|
||||
@item @code{~:@@P}
|
||||
as @code{~@@P but jumps 1 argument backward.}
|
||||
@end table
|
||||
@item @code{~C}
|
||||
Character.
|
||||
@table @asis
|
||||
@item @code{~@@C}
|
||||
prints a character as the reader can understand it (i.e. @code{#\} prefixing).
|
||||
@item @code{~:C}
|
||||
prints a character as emacs does (eg. @code{^C} for ASCII 03).
|
||||
@end table
|
||||
@item @code{~F}
|
||||
Fixed-format floating-point (prints a flonum like @var{mmm.nnn}).
|
||||
@table @asis
|
||||
@item @code{~@var{width},@var{digits},@var{scale},@var{overflowchar},@var{padchar}F}
|
||||
@item @code{~@@F}
|
||||
If the number is positive a plus sign is printed.
|
||||
@end table
|
||||
@item @code{~E}
|
||||
Exponential floating-point (prints a flonum like @var{mmm.nnn}@code{E}@var{ee}).
|
||||
@table @asis
|
||||
@item @code{~@var{width},@var{digits},@var{exponentdigits},@var{scale},@var{overflowchar},@var{padchar},@var{exponentchar}E}
|
||||
@item @code{~@@E}
|
||||
If the number is positive a plus sign is printed.
|
||||
@end table
|
||||
@item @code{~G}
|
||||
General floating-point (prints a flonum either fixed or exponential).
|
||||
@table @asis
|
||||
@item @code{~@var{width},@var{digits},@var{exponentdigits},@var{scale},@var{overflowchar},@var{padchar},@var{exponentchar}G}
|
||||
@item @code{~@@G}
|
||||
If the number is positive a plus sign is printed.
|
||||
@end table
|
||||
@item @code{~$}
|
||||
Dollars floating-point (prints a flonum in fixed with signs separated).
|
||||
@table @asis
|
||||
@item @code{~@var{digits},@var{scale},@var{width},@var{padchar}$}
|
||||
@item @code{~@@$}
|
||||
If the number is positive a plus sign is printed.
|
||||
@item @code{~:@@$}
|
||||
A sign is always printed and appears before the padding.
|
||||
@item @code{~:$}
|
||||
The sign appears before the padding.
|
||||
@end table
|
||||
@item @code{~%}
|
||||
Newline.
|
||||
@table @asis
|
||||
@item @code{~@var{n}%}
|
||||
print @var{n} newlines.
|
||||
@end table
|
||||
@item @code{~&}
|
||||
print newline if not at the beginning of the output line.
|
||||
@table @asis
|
||||
@item @code{~@var{n}&}
|
||||
prints @code{~&} and then @var{n-1} newlines.
|
||||
@end table
|
||||
@item @code{~|}
|
||||
Page Separator.
|
||||
@table @asis
|
||||
@item @code{~@var{n}|}
|
||||
print @var{n} page separators.
|
||||
@end table
|
||||
@item @code{~~}
|
||||
Tilde.
|
||||
@table @asis
|
||||
@item @code{~@var{n}~}
|
||||
print @var{n} tildes.
|
||||
@end table
|
||||
@item @code{~}<newline>
|
||||
Continuation Line.
|
||||
@table @asis
|
||||
@item @code{~:}<newline>
|
||||
newline is ignored, white space left.
|
||||
@item @code{~@@}<newline>
|
||||
newline is left, white space ignored.
|
||||
@end table
|
||||
@item @code{~T}
|
||||
Tabulation.
|
||||
@table @asis
|
||||
@item @code{~@@T}
|
||||
relative tabulation.
|
||||
@item @code{~@var{colnum,colinc}T}
|
||||
full tabulation.
|
||||
@end table
|
||||
@item @code{~?}
|
||||
Indirection (expects indirect arguments as a list).
|
||||
@table @asis
|
||||
@item @code{~@@?}
|
||||
extracts indirect arguments from format arguments.
|
||||
@end table
|
||||
@item @code{~(@var{str}~)}
|
||||
Case conversion (converts by @code{string-downcase}).
|
||||
@table @asis
|
||||
@item @code{~:(@var{str}~)}
|
||||
converts by @code{string-capitalize}.
|
||||
@item @code{~@@(@var{str}~)}
|
||||
converts by @code{string-capitalize-first}.
|
||||
@item @code{~:@@(@var{str}~)}
|
||||
converts by @code{string-upcase}.
|
||||
@end table
|
||||
@item @code{~*}
|
||||
Argument Jumping (jumps 1 argument forward).
|
||||
@table @asis
|
||||
@item @code{~@var{n}*}
|
||||
jumps @var{n} arguments forward.
|
||||
@item @code{~:*}
|
||||
jumps 1 argument backward.
|
||||
@item @code{~@var{n}:*}
|
||||
jumps @var{n} arguments backward.
|
||||
@item @code{~@@*}
|
||||
jumps to the 0th argument.
|
||||
@item @code{~@var{n}@@*}
|
||||
jumps to the @var{n}th argument (beginning from 0)
|
||||
@end table
|
||||
@item @code{~[@var{str0}~;@var{str1}~;...~;@var{strn}~]}
|
||||
Conditional Expression (numerical clause conditional).
|
||||
@table @asis
|
||||
@item @code{~@var{n}[}
|
||||
take argument from @var{n}.
|
||||
@item @code{~@@[}
|
||||
true test conditional.
|
||||
@item @code{~:[}
|
||||
if-else-then conditional.
|
||||
@item @code{~;}
|
||||
clause separator.
|
||||
@item @code{~:;}
|
||||
default clause follows.
|
||||
@end table
|
||||
@item @code{~@{@var{str}~@}}
|
||||
Iteration (args come from the next argument (a list)).
|
||||
@table @asis
|
||||
@item @code{~@var{n}@{}
|
||||
at most @var{n} iterations.
|
||||
@item @code{~:@{}
|
||||
args from next arg (a list of lists).
|
||||
@item @code{~@@@{}
|
||||
args from the rest of arguments.
|
||||
@item @code{~:@@@{}
|
||||
args from the rest args (lists).
|
||||
@end table
|
||||
@item @code{~^}
|
||||
Up and out.
|
||||
@table @asis
|
||||
@item @code{~@var{n}^}
|
||||
aborts if @var{n} = 0
|
||||
@item @code{~@var{n},@var{m}^}
|
||||
aborts if @var{n} = @var{m}
|
||||
@item @code{~@var{n},@var{m},@var{k}^}
|
||||
aborts if @var{n} <= @var{m} <= @var{k}
|
||||
@end table
|
||||
@end table
|
||||
|
||||
|
||||
@subsubsection Not Implemented CL Format Control Directives
|
||||
|
||||
@table @asis
|
||||
@item @code{~:A}
|
||||
print @code{#f} as an empty list (see below).
|
||||
@item @code{~:S}
|
||||
print @code{#f} as an empty list (see below).
|
||||
@item @code{~<~>}
|
||||
Justification.
|
||||
@item @code{~:^}
|
||||
(sorry I don't understand its semantics completely)
|
||||
@end table
|
||||
|
||||
|
||||
@subsubsection Extended, Replaced and Additional Control Directives
|
||||
|
||||
@table @asis
|
||||
@item @code{~@var{mincol},@var{padchar},@var{commachar},@var{commawidth}D}
|
||||
@item @code{~@var{mincol},@var{padchar},@var{commachar},@var{commawidth}X}
|
||||
@item @code{~@var{mincol},@var{padchar},@var{commachar},@var{commawidth}O}
|
||||
@item @code{~@var{mincol},@var{padchar},@var{commachar},@var{commawidth}B}
|
||||
@item @code{~@var{n},@var{mincol},@var{padchar},@var{commachar},@var{commawidth}R}
|
||||
@var{commawidth} is the number of characters between two comma characters.
|
||||
@end table
|
||||
|
||||
@table @asis
|
||||
@item @code{~I}
|
||||
print a R4RS complex number as @code{~F~@@Fi} with passed parameters for
|
||||
@code{~F}.
|
||||
@item @code{~Y}
|
||||
Pretty print formatting of an argument for scheme code lists.
|
||||
@item @code{~K}
|
||||
Same as @code{~?.}
|
||||
@item @code{~!}
|
||||
Flushes the output if format @var{destination} is a port.
|
||||
@item @code{~_}
|
||||
Print a @code{#\space} character
|
||||
@table @asis
|
||||
@item @code{~@var{n}_}
|
||||
print @var{n} @code{#\space} characters.
|
||||
@end table
|
||||
@item @code{~/}
|
||||
Print a @code{#\tab} character
|
||||
@table @asis
|
||||
@item @code{~@var{n}/}
|
||||
print @var{n} @code{#\tab} characters.
|
||||
@end table
|
||||
@item @code{~@var{n}C}
|
||||
Takes @var{n} as an integer representation for a character. No arguments
|
||||
are consumed. @var{n} is converted to a character by
|
||||
@code{integer->char}. @var{n} must be a positive decimal number.@refill
|
||||
@item @code{~:S}
|
||||
Print out readproof. Prints out internal objects represented as
|
||||
@code{#<...>} as strings @code{"#<...>"} so that the format output can always
|
||||
be processed by @code{read}.
|
||||
@refill
|
||||
@item @code{~:A}
|
||||
Print out readproof. Prints out internal objects represented as
|
||||
@code{#<...>} as strings @code{"#<...>"} so that the format output can always
|
||||
be processed by @code{read}.
|
||||
@item @code{~Q}
|
||||
Prints information and a copyright notice on the format implementation.
|
||||
@table @asis
|
||||
@item @code{~:Q}
|
||||
prints format version.
|
||||
@end table
|
||||
@refill
|
||||
@item @code{~F, ~E, ~G, ~$}
|
||||
may also print number strings, i.e. passing a number as a string and
|
||||
format it accordingly.
|
||||
@end table
|
||||
|
||||
@subsubsection Configuration Variables
|
||||
|
||||
Format has some configuration variables at the beginning of
|
||||
@file{format.scm} to suit the systems and users needs. There should be
|
||||
no modification necessary for the configuration that comes with SLIB.
|
||||
If modification is desired the variable should be set after the format
|
||||
code is loaded. Format detects automatically if the running scheme
|
||||
system implements floating point numbers and complex numbers.
|
||||
|
||||
@table @asis
|
||||
|
||||
@item @var{format:symbol-case-conv}
|
||||
Symbols are converted by @code{symbol->string} so the case type of the
|
||||
printed symbols is implementation dependent.
|
||||
@code{format:symbol-case-conv} is a one arg closure which is either
|
||||
@code{#f} (no conversion), @code{string-upcase}, @code{string-downcase}
|
||||
or @code{string-capitalize}. (default @code{#f})
|
||||
|
||||
@item @var{format:iobj-case-conv}
|
||||
As @var{format:symbol-case-conv} but applies for the representation of
|
||||
implementation internal objects. (default @code{#f})
|
||||
|
||||
@item @var{format:expch}
|
||||
The character prefixing the exponent value in @code{~E} printing. (default
|
||||
@code{#\E})
|
||||
|
||||
@end table
|
||||
|
||||
@subsubsection Compatibility With Other Format Implementations
|
||||
|
||||
@table @asis
|
||||
@item SLIB format 2.x:
|
||||
See @file{format.doc}.
|
||||
|
||||
@item SLIB format 1.4:
|
||||
Downward compatible except for padding support and @code{~A}, @code{~S},
|
||||
@code{~P}, @code{~X} uppercase printing. SLIB format 1.4 uses C-style
|
||||
@code{printf} padding support which is completely replaced by the CL
|
||||
@code{format} padding style.
|
||||
|
||||
@item MIT C-Scheme 7.1:
|
||||
Downward compatible except for @code{~}, which is not documented
|
||||
(ignores all characters inside the format string up to a newline
|
||||
character). (7.1 implements @code{~a}, @code{~s},
|
||||
~@var{newline}, @code{~~}, @code{~%}, numerical and variable
|
||||
parameters and @code{:/@@} modifiers in the CL sense).@refill
|
||||
|
||||
@item Elk 1.5/2.0:
|
||||
Downward compatible except for @code{~A} and @code{~S} which print in
|
||||
uppercase. (Elk implements @code{~a}, @code{~s}, @code{~~}, and
|
||||
@code{~%} (no directive parameters or modifiers)).@refill
|
||||
|
||||
@item Scheme->C 01nov91:
|
||||
Downward compatible except for an optional destination parameter: S2C
|
||||
accepts a format call without a destination which returns a formatted
|
||||
string. This is equivalent to a #f destination in S2C. (S2C implements
|
||||
@code{~a}, @code{~s}, @code{~c}, @code{~%}, and @code{~~} (no directive
|
||||
parameters or modifiers)).@refill
|
||||
|
||||
@end table
|
||||
|
||||
This implementation of format is solely useful in the SLIB context
|
||||
because it requires other components provided by SLIB.@refill
|
|
@ -249,7 +249,7 @@ except that a whole file is evaluated instead of a string.
|
|||
|
||||
@code{gh_load} is identical to @code{gh_eval_file} (it's a macro that
|
||||
calls @code{gh_eval_file} on its argument). It is provided to start
|
||||
making the @code{gh_} interface match the R4RS Scheme procedures
|
||||
making the @code{gh_} interface match the R5RS Scheme procedures
|
||||
closely.
|
||||
@end deftypefun
|
||||
|
||||
|
@ -568,8 +568,8 @@ interface; they take and return objects of type SCM, and one could
|
|||
basically use them to write C code that mimics Scheme code.
|
||||
|
||||
I will list these routines here without much explanation, since what
|
||||
they do is the same as documented in @ref{Standard Procedures, R4RS, ,
|
||||
r4rs, R4RS}. But I will point out that when a procedure takes a
|
||||
they do is the same as documented in @ref{Standard procedures, R5RS, ,
|
||||
r5rs, R5RS}. But I will point out that when a procedure takes a
|
||||
variable number of arguments (such as @code{gh_list}), you should pass
|
||||
the constant @var{SCM_EOL} from C to signify the end of the list.
|
||||
|
||||
|
|
|
@ -347,26 +347,26 @@ expression library @emph{rx}, and many more @dots{}
|
|||
@cindex rx
|
||||
|
||||
So Guile has many more primitive procedures available to it than those
|
||||
specified in @ref{Standard Procedures, Revised(4) Report on the
|
||||
Algorithmic Language Scheme, , r4rs, Revised(4) Report on the
|
||||
specified in @ref{Standard Procedures, Revised(5) Report on the
|
||||
Algorithmic Language Scheme, , r5rs, Revised(5) Report on the
|
||||
Algorithmic Language Scheme}. On top of that, Guile will interpret
|
||||
almost all standard Scheme programs. The only incompatible difference
|
||||
between the basic Guile language and R4RS Scheme is that Guile is case
|
||||
sensitive, whereas R4RS is case insensitive. We hope that few people
|
||||
between the basic Guile language and R5RS Scheme is that Guile is case
|
||||
sensitive, whereas R5RS is case insensitive. We hope that few people
|
||||
have written Scheme programs that depend on case insensitivity.
|
||||
@cindex case sensitivity
|
||||
@cindex Revised(4) Report on the Algorithmic Language Scheme
|
||||
@cindex Revised(5) Report on the Algorithmic Language Scheme
|
||||
@cindex report on Scheme
|
||||
@cindex Scheme language - report
|
||||
@cindex Scheme language - definition
|
||||
|
||||
Here is a possible view of the @emph{sum of the parts} in Guile:
|
||||
@cindex extensions to standard Scheme
|
||||
@cindex extensions to R4RS
|
||||
@cindex extensions to R5RS
|
||||
@cindex Scheme extensions
|
||||
@example
|
||||
guile = standard Scheme (R4RS)
|
||||
PLUS extensions to R4RS offered by SCM
|
||||
guile = standard Scheme (R5RS)
|
||||
PLUS extensions to R5RS offered by SCM
|
||||
PLUS some extra primitives offered by Guile (catch/throw)
|
||||
PLUS portable Scheme library (SLIB)
|
||||
PLUS embeddable Scheme interpreter library (libguile)
|
||||
|
|
|
@ -85,10 +85,6 @@
|
|||
@c * should be documented in a section on debugging or Guile internals:
|
||||
@c ports.c: pt-size, pt-member
|
||||
@c eval.c: apply:nconc2last
|
||||
@c * trivial underlying implementations of R4RS functions:
|
||||
@c numbers.c: $asinh, $acosh, $atanh, $sqrt, $abs, $exp, $log, $sin,
|
||||
@c $cos, $tan, $asin, $acos, $atan, $sinh, $cosh, $tanh, $expt,
|
||||
@c $atan2
|
||||
@c
|
||||
@c Thanks. -twp
|
||||
|
||||
|
@ -144,7 +140,7 @@ by the Free Software Foundation.
|
|||
@sp 10
|
||||
@comment The title is printed in a large font.
|
||||
@title Guile Reference Manual
|
||||
@subtitle $Id: guile.texi,v 1.3 2001-04-09 16:16:09 mgrabmue Exp $
|
||||
@subtitle $Id: guile.texi,v 1.4 2001-04-22 14:56:52 ossau Exp $
|
||||
@subtitle For use with Guile @value{VERSION}
|
||||
@author Mark Galassi
|
||||
@author Cygnus Solution and Los Alamos National Laboratory
|
||||
|
|
|
@ -2351,7 +2351,7 @@ standard case is lower case:
|
|||
@deffn primitive symbol->string s
|
||||
Return the name of @var{symbol} as a string. If the symbol was
|
||||
part of an object returned as the value of a literal expression
|
||||
(section @pxref{Literal expressions,,,r4rs, The Revised^4
|
||||
(section @pxref{Literal expressions,,,r5rs, The Revised^5
|
||||
Report on Scheme}) or by a call to the @code{read} procedure,
|
||||
and its name contains alphabetic characters, then the string
|
||||
returned will contain characters in the implementation's
|
||||
|
@ -2544,7 +2544,7 @@ return @code{#f}
|
|||
Keywords are self-evaluating objects with a convenient read syntax that
|
||||
makes them easy to type.
|
||||
|
||||
Guile's keyword support conforms to R4RS, and adds a (switchable) read
|
||||
Guile's keyword support conforms to R5RS, and adds a (switchable) read
|
||||
syntax extension to permit keywords to begin with @code{:} as well as
|
||||
@code{#:}.
|
||||
|
||||
|
@ -2688,9 +2688,9 @@ expression, keywords are self-quoting objects.
|
|||
|
||||
If the @code{keyword} read option is set to @code{'prefix}, Guile also
|
||||
recognizes the alternative read syntax @code{:NAME}. Otherwise, tokens
|
||||
of the form @code{:NAME} are read as symbols, as required by R4RS.
|
||||
of the form @code{:NAME} are read as symbols, as required by R5RS.
|
||||
|
||||
To enable and disable the alternative non-R4RS keyword syntax, you use
|
||||
To enable and disable the alternative non-R5RS keyword syntax, you use
|
||||
the @code{read-options} procedure documented in @ref{General option
|
||||
interface} and @ref{Reader options}.
|
||||
|
||||
|
@ -3058,7 +3058,7 @@ if the last argument is not a proper list.
|
|||
|
||||
@deffn primitive append! . lists
|
||||
A destructive version of @code{append} (@pxref{Pairs and
|
||||
Lists,,,r4rs, The Revised^4 Report on Scheme}). The cdr field
|
||||
lists,,,r5rs, The Revised^5 Report on Scheme}). The cdr field
|
||||
of each list's final pair is changed to point to the head of
|
||||
the next list, so no consing is performed. Return a pointer to
|
||||
the mutated list.
|
||||
|
@ -3072,8 +3072,8 @@ in reverse order.
|
|||
|
||||
@c NJFIXME explain new_tail
|
||||
@deffn primitive reverse! lst [new_tail]
|
||||
A destructive version of @code{reverse} (@pxref{Pairs and Lists,,,r4rs,
|
||||
The Revised^4 Report on Scheme}). The cdr of each cell in @var{lst} is
|
||||
A destructive version of @code{reverse} (@pxref{Pairs and lists,,,r5rs,
|
||||
The Revised^5 Report on Scheme}). The cdr of each cell in @var{lst} is
|
||||
modified to point to the previous list element. Return a pointer to the
|
||||
head of the reversed list.
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ list @code{("" ".scm")}.
|
|||
|
||||
@deffn primitive promise? obj
|
||||
Return true if @var{obj} is a promise, i.e. a delayed computation
|
||||
(@pxref{Delayed evaluation,,,r4rs.info,The Revised^4 Report on Scheme}).
|
||||
(@pxref{Delayed evaluation,,,r5rs.info,The Revised^5 Report on Scheme}).
|
||||
@end deffn
|
||||
|
||||
@rnindex force
|
||||
|
|
|
@ -560,7 +560,6 @@ requested, @code{open-file} throws an exception.
|
|||
@end deffn
|
||||
|
||||
@rnindex open-input-file
|
||||
@c begin (scm-doc-string "r4rs.scm" "open-input-file")
|
||||
@deffn procedure open-input-file filename
|
||||
Open @var{filename} for input. Equivalent to
|
||||
@smalllisp
|
||||
|
@ -569,7 +568,6 @@ Open @var{filename} for input. Equivalent to
|
|||
@end deffn
|
||||
|
||||
@rnindex open-output-file
|
||||
@c begin (scm-doc-string "r4rs.scm" "open-output-file")
|
||||
@deffn procedure open-output-file filename
|
||||
Open @var{filename} for output. Equivalent to
|
||||
@smalllisp
|
||||
|
@ -578,7 +576,6 @@ Open @var{filename} for output. Equivalent to
|
|||
@end deffn
|
||||
|
||||
@rnindex call-with-input-file
|
||||
@c begin (scm-doc-string "r4rs.scm" "call-with-input-file")
|
||||
@deffn procedure call-with-input-file file proc
|
||||
@var{proc} should be a procedure of one argument, and @var{file} should
|
||||
be a string naming a file. The file must already exist. These
|
||||
|
@ -592,7 +589,6 @@ never again be used for a read or write operation.
|
|||
@end deffn
|
||||
|
||||
@rnindex call-with-output-file
|
||||
@c begin (scm-doc-string "r4rs.scm" "call-with-output-file")
|
||||
@deffn procedure call-with-output-file file proc
|
||||
@var{proc} should be a procedure of one argument, and @var{file} should
|
||||
be a string naming a file. The behaviour is unspecified if the file
|
||||
|
@ -606,7 +602,6 @@ port will never again be used for a read or write operation.
|
|||
@end deffn
|
||||
|
||||
@rnindex with-input-from-file
|
||||
@c begin (scm-doc-string "r4rs.scm" "with-input-from-file")
|
||||
@deffn procedure with-input-from-file file thunk
|
||||
@var{thunk} must be a procedure of no arguments, and @var{file} must be
|
||||
a string naming a file. The file must already exist. The file is opened
|
||||
|
@ -620,7 +615,6 @@ dependent.
|
|||
@end deffn
|
||||
|
||||
@rnindex with-output-to-file
|
||||
@c begin (scm-doc-string "r4rs.scm" "with-output-to-file")
|
||||
@deffn procedure with-output-to-file file thunk
|
||||
@var{thunk} must be a procedure of no arguments, and @var{file} must be
|
||||
a string naming a file. The effect is unspecified if the file already
|
||||
|
@ -633,7 +627,6 @@ used to escape from the continuation of these procedures, their behavior
|
|||
is implementation dependent.
|
||||
@end deffn
|
||||
|
||||
@c begin (scm-doc-string "r4rs.scm" "with-error-to-file")
|
||||
@deffn procedure with-error-to-file file thunk
|
||||
@var{thunk} must be a procedure of no arguments, and @var{file} must be
|
||||
a string naming a file. The effect is unspecified if the file already
|
||||
|
@ -689,14 +682,12 @@ created input port from which @var{string}'s contents may be
|
|||
read. The value yielded by the @var{proc} is returned.
|
||||
@end deffn
|
||||
|
||||
@c begin (scm-doc-string "r4rs.scm" "with-output-to-string")
|
||||
@deffn procedure with-output-to-string thunk
|
||||
Calls the zero-argument procedure @var{thunk} with the current output
|
||||
port set temporarily to a new string port. It returns a string
|
||||
composed of the characters written to the current output.
|
||||
@end deffn
|
||||
|
||||
@c begin (scm-doc-string "r4rs.scm" "with-input-from-string")
|
||||
@deffn procedure with-input-from-string string thunk
|
||||
Calls the zero-argument procedure @var{thunk} with the current input
|
||||
port set temporarily to a string port opened on the specified
|
||||
|
@ -758,7 +749,7 @@ procedures. For an input-only port only elements 3 and 4 need
|
|||
be procedures. Thunks 2 and 4 can instead be @code{#f} if
|
||||
there is no useful operation for them to perform.
|
||||
If thunk 3 returns @code{#f} or an @code{eof-object}
|
||||
(@pxref{Input, eof-object?, ,r4rs, The Revised^4 Report on
|
||||
(@pxref{Input, eof-object?, ,r5rs, The Revised^5 Report on
|
||||
Scheme}) it indicates that the port has reached end-of-file.
|
||||
For example:
|
||||
@lisp
|
||||
|
|
|
@ -46,7 +46,7 @@ clutter the global name space.
|
|||
@node Scheme and modules
|
||||
@section Scheme and modules
|
||||
|
||||
Scheme, as defined in R4RS, does @emph{not} have a module system at all.
|
||||
Scheme, as defined in R5RS, does @emph{not} have a module system at all.
|
||||
|
||||
Aubrey Jaffer, mostly to support his portable Scheme library SLIB,
|
||||
implemented a provide/require mechanism for many Scheme implementations.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue