1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

* scheme-data.texi (Arithmetic): Documented the arithmetic

procedures.
	(Integer Operations): Added documentation.
	(Comparison): Added documentation.
	(Complex): Added documentation.
	(Symbols and Variables): Comment out `builtin-bindings', which is
	removed according to NEWS.
	(Pairs): Added documentation.
	* scheme-io.texi: Added R5RS index entries for all R5RS
	procedures.
	(File Ports): New docs for `call-with-input-file',
	`call-with-output-file', `with-input-from-file',
	`with-output-to-file', `with-error-to-file'.
	* scheme-control.texi, scheme-utility.texi,
	* scheme-procedures.texi: Added R5RS index entries for all R5RS
	procedures.
	* scheme-evaluation.texi (Fly Evaluation): Added documentation for
	`apply'.  Added R5RS index entries for all R5RS procedures.
	* scheme-data.texi: Added R5RS index entries for all R5RS
	procedures.  Removed R5RS index entries for `ass{q,v,occ}-set!'.
	Removed explicit entries into the function entries.  They are
	automagic.
	(Vectors): Added documentation for `make-vector', `vector-ref' and
	`vector-set!'.
This commit is contained in:
Martin Grabmüller 2001-03-16 17:00:21 +00:00
parent 5352393c55
commit fcaedf9936
7 changed files with 382 additions and 39 deletions

View file

@ -1,3 +1,34 @@
2001-03-16 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
* scheme-data.texi (Arithmetic): Documented the arithmetic
procedures.
(Integer Operations): Added documentation.
(Comparison): Added documentation.
(Complex): Added documentation.
(Symbols and Variables): Comment out `builtin-bindings', which is
removed according to NEWS.
(Pairs): Added documentation.
* scheme-io.texi: Added R5RS index entries for all R5RS
procedures.
(File Ports): New docs for `call-with-input-file',
`call-with-output-file', `with-input-from-file',
`with-output-to-file', `with-error-to-file'.
* scheme-control.texi, scheme-utility.texi,
* scheme-procedures.texi: Added R5RS index entries for all R5RS
procedures.
* scheme-evaluation.texi (Fly Evaluation): Added documentation for
`apply'. Added R5RS index entries for all R5RS procedures.
* scheme-data.texi: Added R5RS index entries for all R5RS
procedures. Removed R5RS index entries for `ass{q,v,occ}-set!'.
Removed explicit entries into the function entries. They are
automagic.
(Vectors): Added documentation for `make-vector', `vector-ref' and
`vector-set!'.
2001-03-12 Marius Vollmer <mvo@zagadka.ping.de> 2001-03-12 Marius Vollmer <mvo@zagadka.ping.de>
* intro.texi: Changed to reflect current practice better. Added * intro.texi: Changed to reflect current practice better. Added

View file

@ -34,10 +34,15 @@
@node Continuations @node Continuations
@section Continuations @section Continuations
@r5index call-with-current-continuation
@c FIXME::martin: Document me!
@deffn primitive call-with-current-continuation
@end deffn
@node Multiple Values @node Multiple Values
@section Returning and Accepting Multiple Values @section Returning and Accepting Multiple Values
@r5index values
@deffn primitive values . args @deffn primitive values . args
Delivers all of its arguments to its continuation. Except for Delivers all of its arguments to its continuation. Except for
continuations created by the @code{call-with-values} procedure, continuations created by the @code{call-with-values} procedure,
@ -46,6 +51,7 @@ passing no value or more than one value to continuations that
were not created by @code{call-with-values} is unspecified. were not created by @code{call-with-values} is unspecified.
@end deffn @end deffn
@r5index call-with-values
@deffn primitive call-with-values producer consumer @deffn primitive call-with-values producer consumer
Calls its @var{producer} argument with no values and a Calls its @var{producer} argument with no values and a
continuation that, when passed some values, calls the continuation that, when passed some values, calls the
@ -174,6 +180,7 @@ if an exception occurs then @code{#f} is returned instead.
[FIXME: this is pasted in from Tom Lord's original guile.texi and should [FIXME: this is pasted in from Tom Lord's original guile.texi and should
be reviewed] be reviewed]
@r5index dynamic-wind
@c ARGFIXME in-guard/thunk1 thunk/thunk2 out-guard/thunk3 @c ARGFIXME in-guard/thunk1 thunk/thunk2 out-guard/thunk3
@c docstring begin (texi-doc-string "guile" "dynamic-wind") @c docstring begin (texi-doc-string "guile" "dynamic-wind")
@deffn primitive dynamic-wind thunk1 thunk2 thunk3 @deffn primitive dynamic-wind thunk1 thunk2 thunk3

View file

@ -63,6 +63,8 @@ sections of this manual that cover them.
@node Booleans @node Booleans
@section Booleans @section Booleans
@r5index not
@r5index boolean?
The two boolean values are @code{#t} for true and @code{#f} for false. The two boolean values are @code{#t} for true and @code{#f} for false.
@ -167,6 +169,7 @@ in Scheme, which is particularly clear and accessible: see
@node Numerical Tower @node Numerical Tower
@subsection Scheme's Numerical ``Tower'' @subsection Scheme's Numerical ``Tower''
@r5index number?
Scheme's numerical ``tower'' consists of the following categories of Scheme's numerical ``tower'' consists of the following categories of
numbers: numbers:
@ -229,6 +232,7 @@ in detail.
@node Integers @node Integers
@subsection Integers @subsection Integers
@r5index integer?
Integers are whole numbers, that is numbers with no fractional part, Integers are whole numbers, that is numbers with no fractional part,
such as 2, 83 and -3789. such as 2, 83 and -3789.
@ -287,6 +291,8 @@ Return @code{#t} if @var{obj} is an integer number, @code{#f} else.
@node Reals and Rationals @node Reals and Rationals
@subsection Real and Rational Numbers @subsection Real and Rational Numbers
@r5index real?
@r5index rational?
Mathematically, the real numbers are the set of numbers that describe Mathematically, the real numbers are the set of numbers that describe
all possible points along a continuous, infinite, one-dimensional line. all possible points along a continuous, infinite, one-dimensional line.
@ -347,6 +353,7 @@ is an integer number.
@node Complex Numbers @node Complex Numbers
@subsection Complex Numbers @subsection Complex Numbers
@r5index complex?
Complex numbers are the set of numbers that describe all possible points Complex numbers are the set of numbers that describe all possible points
in a two-dimensional space. The two coordinates of a particular point in a two-dimensional space. The two coordinates of a particular point
@ -382,6 +389,10 @@ the set of complex numbers, so the predicate will also be fulfilled if
@node Exactness @node Exactness
@subsection Exact and Inexact Numbers @subsection Exact and Inexact Numbers
@r5index exact?
@r5index inexact?
@r5index exact->inexact
@r5index inexact->exact
R5RS requires that a calculation involving inexact numbers always R5RS requires that a calculation involving inexact numbers always
produces an inexact result. To meet this requirement, Guile produces an inexact result. To meet this requirement, Guile
@ -403,11 +414,12 @@ Return #t if X is an inexact number, #f else.
@c docstring begin (texi-doc-string "guile" "inexact->exact") @c docstring begin (texi-doc-string "guile" "inexact->exact")
@deffn primitive inexact->exact z @deffn primitive inexact->exact z
Returns an exact number that is numerically closest to Z. Returns an exact number that is numerically closest to @var{z}.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "exact->inexact") @c begin (texi-doc-string "guile" "exact->inexact")
@deffn primitive exact->inexact @deffn primitive exact->inexact z
Convert the number @var{z} to its inexact representation.
@end deffn @end deffn
@ -480,6 +492,13 @@ multiplying by 10^N.
@node Integer Operations @node Integer Operations
@subsection Operations on Integer Values @subsection Operations on Integer Values
@r5index odd?
@r5index even?
@r5index quotient
@r5index remainder
@r5index modulo
@r5index gcd
@r5index lcm
@c docstring begin (texi-doc-string "guile" "odd?") @c docstring begin (texi-doc-string "guile" "odd?")
@deffn primitive odd? n @deffn primitive odd? n
@ -493,63 +512,98 @@ Return #t if N is an even number, #f otherwise.
@c begin (texi-doc-string "guile" "quotient") @c begin (texi-doc-string "guile" "quotient")
@deffn primitive quotient @deffn primitive quotient
Return the quotient of the numbers @var{x} and @var{y}.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "remainder") @c begin (texi-doc-string "guile" "remainder")
@deffn primitive remainder @deffn primitive remainder
Return the remainder of the numbers @var{x} and @var{y}.
@lisp
(remainder 13 4) @result{} 1
(remainder -13 4) @result{} -1
@end lisp
@end deffn @end deffn
@c begin (texi-doc-string "guile" "modulo") @c begin (texi-doc-string "guile" "modulo")
@deffn primitive modulo @deffn primitive modulo
Return the modulo of the numbers @var{x} and @var{y}.
@lisp
(modulo 13 4) @result{} 1
(modulo -13 4) @result{} 3
@end lisp
@end deffn @end deffn
@c begin (texi-doc-string "guile" "gcd") @c begin (texi-doc-string "guile" "gcd")
@deffn primitive gcd @deffn primitive gcd
Return the greatest common divisor of all arguments.
If called without arguments, 0 is returned.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "lcm") @c begin (texi-doc-string "guile" "lcm")
@deffn primitive lcm @deffn primitive lcm
Return the least common multiple of the arguments.
If called without arguments, 1 is returned.
@end deffn @end deffn
@node Comparison @node Comparison
@subsection Comparison Predicates @subsection Comparison Predicates
@r5index zero?
@r5index positive?
@r5index negative?
@c begin (texi-doc-string "guile" "=") @c begin (texi-doc-string "guile" "=")
@deffn primitive = @deffn primitive =
Return @code{#t} if all parameters are numerically equal.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "<") @c begin (texi-doc-string "guile" "<")
@deffn primitive < @deffn primitive <
Return @code{#t} if the list of parameters is monotonically
increasing.
@end deffn @end deffn
@c begin (texi-doc-string "guile" ">") @c begin (texi-doc-string "guile" ">")
@deffn primitive > @deffn primitive >
Return @code{#t} if the list of parameters is monotonically
decreasing.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "<=") @c begin (texi-doc-string "guile" "<=")
@deffn primitive <= @deffn primitive <=
Return @code{#t} if the list of parameters is monotonically
non-decreasing.
@end deffn @end deffn
@c begin (texi-doc-string "guile" ">=") @c begin (texi-doc-string "guile" ">=")
@deffn primitive >= @deffn primitive >=
Return @code{#t} if the list of parameters is monotonically
non-increasing.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "zero?") @c begin (texi-doc-string "guile" "zero?")
@deffn primitive zero? @deffn primitive zero?
Return @code{#t} if @var{z} is an exact or inexact number equal to
zero.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "positive?") @c begin (texi-doc-string "guile" "positive?")
@deffn primitive positive? @deffn primitive positive?
Return @code{#t} if @var{x} is an exact or inexact number greater than
zero.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "negative?") @c begin (texi-doc-string "guile" "negative?")
@deffn primitive negative? @deffn primitive negative?
Return @code{#t} if @var{x} is an exact or inexact number less than
zero.
@end deffn @end deffn
@node Conversion @node Conversion
@subsection Converting Numbers To and From Strings @subsection Converting Numbers To and From Strings
@r5index number->string
@r5index string->number
@c docstring begin (texi-doc-string "guile" "number->string") @c docstring begin (texi-doc-string "guile" "number->string")
@deffn primitive number->string n [radix] @deffn primitive number->string n [radix]
@ -572,6 +626,12 @@ for a number, then `string->number' returns #f. (r5rs)
@node Complex @node Complex
@subsection Complex Number Operations @subsection Complex Number Operations
@r5index make-rectangular
@r5index make-polar
@r5index real-part
@r5index imag-part
@r5index magnitude
@r5index angle
@c docstring begin (texi-doc-string "guile" "make-rectangular") @c docstring begin (texi-doc-string "guile" "make-rectangular")
@deffn primitive make-rectangular real imaginary @deffn primitive make-rectangular real imaginary
@ -586,71 +646,111 @@ Return the complex number X * e^(i * Y).
@c begin (texi-doc-string "guile" "real-part") @c begin (texi-doc-string "guile" "real-part")
@deffn primitive real-part @deffn primitive real-part
Return the real part of the number @var{z}.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "imag-part") @c begin (texi-doc-string "guile" "imag-part")
@deffn primitive imag-part @deffn primitive imag-part
Return the imaginary part of the number @var{z}.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "magnitude") @c begin (texi-doc-string "guile" "magnitude")
@deffn primitive magnitude @deffn primitive magnitude
Return the magnitude of the number @var{z}. This is the same as
@code{abs} for real arguments, but also allows complex numbers.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "angle") @c begin (texi-doc-string "guile" "angle")
@deffn primitive angle @deffn primitive angle
Return the angle of the complex number @var{z}.
@end deffn @end deffn
@node Arithmetic @node Arithmetic
@subsection Arithmetic Functions @subsection Arithmetic Functions
@r5index max
@r5index min
@r5index +
@r5index *
@r5index -
@r5index /
@r5index abs
@r5index floor
@r5index ceiling
@r5index truncate
@r5index round
@c begin (texi-doc-string "guile" "+") @c begin (texi-doc-string "guile" "+")
@deffn primitive + @deffn primitive + z1 @dots{}
Return the sum of all parameter values. Return 0 if called without any
parameters.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "-") @c begin (texi-doc-string "guile" "-")
@deffn primitive - @deffn primitive - z1 z2 @dots{}
If called without arguments, 0 is returned. Otherwise the sum of all but
the first argument are subtracted from the first argument.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "*") @c begin (texi-doc-string "guile" "*")
@deffn primitive * @deffn primitive * z1 @dots{}
Return the product of all arguments. If called without arguments, 1 is
returned.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "/") @c begin (texi-doc-string "guile" "/")
@deffn primitive / @deffn primitive / z1 z2 @dots{}
Divide the first argument by the product of the remaining arguments.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "abs") @c begin (texi-doc-string "guile" "abs")
@deffn primitive abs @deffn primitive abs x
Return the absolute value of @var{x}.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "max") @c begin (texi-doc-string "guile" "max")
@deffn primitive max @deffn primitive max x1 x2 @dots{}
Return the maximum of all parameter values.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "min") @c begin (texi-doc-string "guile" "min")
@deffn primitive min @deffn primitive min x1 x2 @dots{}
Return the minium of all parameter values.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "truncate") @c begin (texi-doc-string "guile" "truncate")
@deffn primitive truncate @deffn primitive truncate
Round the inexact number @var{x} towards zero.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "round") @c begin (texi-doc-string "guile" "round")
@deffn primitive round @deffn primitive round x
Round the inexact number @var{x} towards zero.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "floor") @c begin (texi-doc-string "guile" "floor")
@deffn primitive floor @deffn primitive floor x
Round the number @var{x} towards minus infinity.
@end deffn @end deffn
@c begin (texi-doc-string "guile" "ceiling") @c begin (texi-doc-string "guile" "ceiling")
@deffn primitive ceiling @deffn primitive ceiling x
Round the number @var{x} towards infinity.
@end deffn @end deffn
@node Scientific @node Scientific
@subsection Scientific Functions @subsection Scientific Functions
@r5index exp
@r5index log
@r5index sin
@r5index cos
@r5index tan
@r5index asin
@r5index acos
@r5index atan
@r5index sqrt
@r5index expt
The following procedures accept any kind of number as arguments, The following procedures accept any kind of number as arguments,
including complex numbers. including complex numbers.
@ -1083,6 +1183,22 @@ Return a new random state using @var{seed}.
@node Characters @node Characters
@section Characters @section Characters
@r5index char?
@r5index char=?
@r5index char<?
@r5index char>?
@r5index char<=?
@r5index char>=?
@r5index char-alphabetic?
@r5index char-numeric?
@r5index char-whitespace?
@r5index char-upper-case?
@r5index char-lower-case?
@r5index char->integer
@r5index integer->char
@r5index char-upcase
@r5index char-downcase
Most of the characters in the ASCII character set may be referred to by Most of the characters in the ASCII character set may be referred to by
name: for example, @code{#\tab}, @code{#\esc}, @code{#\stx}, and so on. name: for example, @code{#\tab}, @code{#\esc}, @code{#\stx}, and so on.
@ -1290,6 +1406,8 @@ eventually, and it will be helpful to know how they work.
@node String Fun @node String Fun
@subsection String Fun @subsection String Fun
@r5index string
@r5index list->string
@c docstring begin (texi-doc-string "guile" "string") @c docstring begin (texi-doc-string "guile" "string")
@c docstring begin (texi-doc-string "guile" "list->string") @c docstring begin (texi-doc-string "guile" "list->string")
@deffn primitive string . chrs @deffn primitive string . chrs
@ -1298,6 +1416,7 @@ Returns a newly allocated string composed of the arguments,
@var{chrs}. @var{chrs}.
@end deffn @end deffn
@r5index make-string
@c docstring begin (texi-doc-string "guile" "make-string") @c docstring begin (texi-doc-string "guile" "make-string")
@deffn primitive make-string k [chr] @deffn primitive make-string k [chr]
Return a newly allocated string of Return a newly allocated string of
@ -1306,23 +1425,27 @@ the string are initialized to @var{chr}, otherwise the contents
of the @var{string} are unspecified. of the @var{string} are unspecified.
@end deffn @end deffn
@r5index string-append
@c docstring begin (texi-doc-string "guile" "string-append") @c docstring begin (texi-doc-string "guile" "string-append")
@deffn primitive string-append . args @deffn primitive string-append . args
Return a newly allocated string whose characters form the Return a newly allocated string whose characters form the
concatenation of the given strings, @var{args}. concatenation of the given strings, @var{args}.
@end deffn @end deffn
@r5index string-length
@c docstring begin (texi-doc-string "guile" "string-length") @c docstring begin (texi-doc-string "guile" "string-length")
@deffn primitive string-length string @deffn primitive string-length string
Return the number of characters in @var{string}. Return the number of characters in @var{string}.
@end deffn @end deffn
@r5index string-ref
@c docstring begin (texi-doc-string "guile" "string-ref") @c docstring begin (texi-doc-string "guile" "string-ref")
@deffn primitive string-ref str k @deffn primitive string-ref str k
Return character @var{k} of @var{str} using zero-origin Return character @var{k} of @var{str} using zero-origin
indexing. @var{k} must be a valid index of @var{str}. indexing. @var{k} must be a valid index of @var{str}.
@end deffn @end deffn
@r5index string-set!
@c docstring begin (texi-doc-string "guile" "string-set!") @c docstring begin (texi-doc-string "guile" "string-set!")
@deffn primitive string-set! str k chr @deffn primitive string-set! str k chr
Store @var{chr} in element @var{k} of @var{str} and return Store @var{chr} in element @var{k} of @var{str} and return
@ -1330,12 +1453,14 @@ an unspecified value. @var{k} must be a valid index of
@var{str}. @var{str}.
@end deffn @end deffn
@r5index string?
@c docstring begin (texi-doc-string "guile" "string?") @c docstring begin (texi-doc-string "guile" "string?")
@deffn primitive string? obj @deffn primitive string? obj
Returns @code{#t} iff @var{obj} is a string, else returns Returns @code{#t} iff @var{obj} is a string, else returns
@code{#f}. @code{#f}.
@end deffn @end deffn
@r5index substring
@c docstring begin (texi-doc-string "guile" "substring") @c docstring begin (texi-doc-string "guile" "substring")
@deffn primitive substring str start [end] @deffn primitive substring str start [end]
Return a newly allocated string formed from the characters Return a newly allocated string formed from the characters
@ -1566,6 +1691,7 @@ Destructively capitalize every character in @code{str}.
Capitalize every character in @code{str}. Capitalize every character in @code{str}.
@end deffn @end deffn
@r5index string<=?
@c docstring begin (texi-doc-string "guile" "string-ci<=?") @c docstring begin (texi-doc-string "guile" "string-ci<=?")
@deffn primitive string-ci<=? s1 s2 @deffn primitive string-ci<=? s1 s2
Case insensitive lexicographic ordering predicate; Case insensitive lexicographic ordering predicate;
@ -1573,6 +1699,7 @@ returns @t{#t} if @var{s1} is lexicographically less than
or equal to @var{s2} regardless of case. (r5rs) or equal to @var{s2} regardless of case. (r5rs)
@end deffn @end deffn
@r5index string-ci<
@c docstring begin (texi-doc-string "guile" "string-ci<?") @c docstring begin (texi-doc-string "guile" "string-ci<?")
@deffn primitive string-ci<? s1 s2 @deffn primitive string-ci<? s1 s2
Case insensitive lexicographic ordering predicate; Case insensitive lexicographic ordering predicate;
@ -1580,6 +1707,7 @@ returns @t{#t} if @var{s1} is lexicographically less than
@var{s2} regardless of case. (r5rs) @var{s2} regardless of case. (r5rs)
@end deffn @end deffn
@r5index string-ci=?
@c docstring begin (texi-doc-string "guile" "string-ci=?") @c docstring begin (texi-doc-string "guile" "string-ci=?")
@deffn primitive string-ci=? s1 s2 @deffn primitive string-ci=? s1 s2
Case-insensitive string equality predicate; returns @t{#t} if Case-insensitive string equality predicate; returns @t{#t} if
@ -1587,6 +1715,7 @@ the two strings are the same length and their component characters
match (ignoring case) at each position; otherwise returns @t{#f}. (r5rs) match (ignoring case) at each position; otherwise returns @t{#f}. (r5rs)
@end deffn @end deffn
@r5index string-ci>=?
@c docstring begin (texi-doc-string "guile" "string-ci>=?") @c docstring begin (texi-doc-string "guile" "string-ci>=?")
@deffn primitive string-ci>=? s1 s2 @deffn primitive string-ci>=? s1 s2
Case insensitive lexicographic ordering predicate; Case insensitive lexicographic ordering predicate;
@ -1594,6 +1723,7 @@ returns @t{#t} if @var{s1} is lexicographically greater than
or equal to @var{s2} regardless of case. (r5rs) or equal to @var{s2} regardless of case. (r5rs)
@end deffn @end deffn
@r5index string-ci>?
@c docstring begin (texi-doc-string "guile" "string-ci>?") @c docstring begin (texi-doc-string "guile" "string-ci>?")
@deffn primitive string-ci>? s1 s2 @deffn primitive string-ci>? s1 s2
Case insensitive lexicographic ordering predicate; Case insensitive lexicographic ordering predicate;
@ -1601,18 +1731,21 @@ returns @t{#t} if @var{s1} is lexicographically greater than
@var{s2} regardless of case. (r5rs) @var{s2} regardless of case. (r5rs)
@end deffn @end deffn
@r5index string<=?
@c docstring begin (texi-doc-string "guile" "string<=?") @c docstring begin (texi-doc-string "guile" "string<=?")
@deffn primitive string<=? s1 s2 @deffn primitive string<=? s1 s2
Lexicographic ordering predicate; returns @t{#t} if @var{s1} Lexicographic ordering predicate; returns @t{#t} if @var{s1}
is lexicographically less than or equal to @var{s2}. (r5rs) is lexicographically less than or equal to @var{s2}. (r5rs)
@end deffn @end deffn
@r5index string<?
@c docstring begin (texi-doc-string "guile" "string<?") @c docstring begin (texi-doc-string "guile" "string<?")
@deffn primitive string<? s1 s2 @deffn primitive string<? s1 s2
Lexicographic ordering predicate; returns @t{#t} if @var{s1} Lexicographic ordering predicate; returns @t{#t} if @var{s1}
is lexicographically less than @var{s2}. (r5rs) is lexicographically less than @var{s2}. (r5rs)
@end deffn @end deffn
@r5index string=?
@c docstring begin (texi-doc-string "guile" "string=?") @c docstring begin (texi-doc-string "guile" "string=?")
@deffn primitive string=? s1 s2 @deffn primitive string=? s1 s2
Lexicographic equality predicate; Lexicographic equality predicate;
@ -1624,18 +1757,21 @@ upper and lower case letters as though they were the same character, but
@samp{string=?} treats upper and lower case as distinct characters. @samp{string=?} treats upper and lower case as distinct characters.
@end deffn @end deffn
@r5index string>=?
@c docstring begin (texi-doc-string "guile" "string>=?") @c docstring begin (texi-doc-string "guile" "string>=?")
@deffn primitive string>=? s1 s2 @deffn primitive string>=? s1 s2
Lexicographic ordering predicate; returns @t{#t} if @var{s1} Lexicographic ordering predicate; returns @t{#t} if @var{s1}
is lexicographically greater than or equal to @var{s2}. (r5rs) is lexicographically greater than or equal to @var{s2}. (r5rs)
@end deffn @end deffn
@r5index string>?
@c docstring begin (texi-doc-string "guile" "string>?") @c docstring begin (texi-doc-string "guile" "string>?")
@deffn primitive string>? s1 s2 @deffn primitive string>? s1 s2
Lexicographic ordering predicate; returns @t{#t} if @var{s1} Lexicographic ordering predicate; returns @t{#t} if @var{s1}
is lexicographically greater than @var{s2}. (r5rs) is lexicographically greater than @var{s2}. (r5rs)
@end deffn @end deffn
@r5index string->list
@c docstring begin (texi-doc-string "guile" "string->list") @c docstring begin (texi-doc-string "guile" "string->list")
@deffn primitive string->list str @deffn primitive string->list str
@samp{String->list} returns a newly allocated list of the @samp{String->list} returns a newly allocated list of the
@ -1651,11 +1787,13 @@ inverses so far as @samp{equal?} is concerned. (r5rs)
Return the symbol whose name is @var{str}, downcased in necessary(???). Return the symbol whose name is @var{str}, downcased in necessary(???).
@end deffn @end deffn
@r5index string-copy
@c docstring begin (texi-doc-string "guile" "string-copy") @c docstring begin (texi-doc-string "guile" "string-copy")
@deffn primitive string-copy str @deffn primitive string-copy str
Returns a newly allocated copy of the given @var{string}. (r5rs) Returns a newly allocated copy of the given @var{string}. (r5rs)
@end deffn @end deffn
@r5index string-fill!
@c docstring begin (texi-doc-string "guile" "string-fill!") @c docstring begin (texi-doc-string "guile" "string-fill!")
@deffn primitive string-fill! str chr @deffn primitive string-fill! str chr
Stores @var{char} in every element of the given @var{string} and returns an Stores @var{char} in every element of the given @var{string} and returns an
@ -2244,6 +2382,10 @@ Test whether obj is a compiled regular expression.
@node Symbols and Variables @node Symbols and Variables
@section Symbols and Variables @section Symbols and Variables
@r5index symbol?
@r5index symbol->string
@r5index string->symbol
Guile symbol tables are hash tables. Each hash table, also called an Guile symbol tables are hash tables. Each hash table, also called an
@dfn{obarray} (for `object array'), is a vector of association lists. @dfn{obarray} (for `object array'), is a vector of association lists.
@ -2252,11 +2394,13 @@ Each entry in the alists is a pair (@var{SYMBOL} . @var{VALUE}). To
(@var{SYMBOL} . @var{VALUE}) pair, adding a new entry to the symbol (@var{SYMBOL} . @var{VALUE}) pair, adding a new entry to the symbol
table (with an undefined value) if none is yet present. table (with an undefined value) if none is yet present.
@c docstring begin (texi-doc-string "guile" "builtin-bindings") @c FIXME::martin: According to NEWS, removed. Remove here too, or
@deffn primitive builtin-bindings @c leave for compatibility?
Create and return a copy of the global symbol table, removing all @c @c docstring begin (texi-doc-string "guile" "builtin-bindings")
unbound symbols. @c @deffn primitive builtin-bindings
@end deffn @c Create and return a copy of the global symbol table, removing all
@c unbound symbols.
@c @end deffn
@c docstring begin (texi-doc-string "guile" "gensym") @c docstring begin (texi-doc-string "guile" "gensym")
@deffn primitive gensym [prefix] @deffn primitive gensym [prefix]
@ -2695,6 +2839,10 @@ This is the inverse of @code{make-keyword-from-dash-symbol}.
@node Pairs @node Pairs
@section Pairs @section Pairs
@r5index pair?
@r5index cons
@r5index set-car!
@r5index set-cdr!
@c docstring begin (texi-doc-string "guile" "cons") @c docstring begin (texi-doc-string "guile" "cons")
@deffn primitive cons x y @deffn primitive cons x y
@ -2708,6 +2856,25 @@ Returns a newly allocated pair whose car is @var{x} and whose cdr is
Returns @code{#t} if @var{x} is a pair; otherwise returns @code{#f}. Returns @code{#t} if @var{x} is a pair; otherwise returns @code{#f}.
@end deffn @end deffn
@r5index car
@r5index cdr
@deffn primitive car pair
@deffnx primitive cdr pair
Return the car or the cdr of @var{pair}, respectively.
@end deffn
@deffn primitive caar pair
@deffnx primitive cadr pair @dots{}
@deffnx primitive cdddar pair
@deffnx primitive cddddr pair
These procedures are compositions of @code{car} and @code{cdr}, where
for example @code{caddr} could be defined by
@lisp
(define caddr (lambda (x) (car (cdr (cdr x)))))
@end lisp
@end deffn
@c docstring begin (texi-doc-string "guile" "set-car!") @c docstring begin (texi-doc-string "guile" "set-car!")
@deffn primitive set-car! pair value @deffn primitive set-car! pair value
Stores @var{value} in the car field of @var{pair}. The value returned Stores @var{value} in the car field of @var{pair}. The value returned
@ -2723,6 +2890,18 @@ by @code{set-cdr!} is unspecified.
@node Lists @node Lists
@section Lists @section Lists
@r5index null?
@r5index list?
@r5index list
@r5index length
@r5index append
@r5index reverse
@r5index list-tail
@r5index list-ref
@r5index memq
@r5index memv
@r5index member
@c docstring begin (texi-doc-string "guile" "list") @c docstring begin (texi-doc-string "guile" "list")
@deffn primitive list . objs @deffn primitive list . objs
@ -2958,12 +3137,14 @@ Its use is recommended only in writing Guile internals,
not for high-level Scheme programs. not for high-level Scheme programs.
@end deffn @end deffn
@r5index map
@c begin (texi-doc-string "guile" "map") @c begin (texi-doc-string "guile" "map")
@c docstring begin (texi-doc-string "guile" "map-in-order") @c docstring begin (texi-doc-string "guile" "map-in-order")
@deffn primitive map proc arg1 . args @deffn primitive map proc arg1 . args
@deffnx primitive map-in-order proc arg1 . args @deffnx primitive map-in-order proc arg1 . args
@end deffn @end deffn
@r5index for-each
@c begin (texi-doc-string "guile" "for-each") @c begin (texi-doc-string "guile" "for-each")
@deffn primitive for-each proc arg1 . args @deffn primitive for-each proc arg1 . args
@end deffn @end deffn
@ -3990,13 +4171,6 @@ lists which do not require their entries' keys to be unique.
@node Adding or Setting Alist Entries @node Adding or Setting Alist Entries
@subsubsection Adding or Setting Alist Entries @subsubsection Adding or Setting Alist Entries
@findex acons
@findex assq-set!
@findex assv-set!
@findex assoc-set!
@r5index assq-set!
@r5index assv-set!
@r5index assoc-set!
@code{acons} adds a new entry to an association list and returns the @code{acons} adds a new entry to an association list and returns the
combined association list. The combined alist is formed by consing the combined association list. The combined alist is formed by consing the
@ -4124,18 +4298,9 @@ association list.
@node Retrieving Alist Entries @node Retrieving Alist Entries
@subsubsection Retrieving Alist Entries @subsubsection Retrieving Alist Entries
@findex assq
@findex assv
@findex assoc
@findex assq-ref
@findex assv-ref
@findex assoc-ref
@r5index assq @r5index assq
@r5index assv @r5index assv
@r5index assoc @r5index assoc
@r5index assq-ref
@r5index assv-ref
@r5index assoc-ref
@code{assq}, @code{assv} and @code{assoc} take an alist and a key as @code{assq}, @code{assv} and @code{assoc} take an alist and a key as
arguments and return the entry for that key if an entry exists, or arguments and return the entry for that key if an entry exists, or
@ -4190,9 +4355,6 @@ where @var{associator} is one of @code{assq}, @code{assv} or @code{assoc}.
@node Removing Alist Entries @node Removing Alist Entries
@subsubsection Removing Alist Entries @subsubsection Removing Alist Entries
@findex assq-remove!
@findex assv-remove!
@findex assoc-remove!
To remove the element from an association list whose key matches a To remove the element from an association list whose key matches a
specified key, use @code{assq-remove!}, @code{assv-remove!} or specified key, use @code{assq-remove!}, @code{assv-remove!} or
@ -4261,9 +4423,6 @@ the resulting alist.
@node Sloppy Alist Functions @node Sloppy Alist Functions
@subsubsection Sloppy Alist Functions @subsubsection Sloppy Alist Functions
@findex sloppy-assq
@findex sloppy-assv
@findex sloppy-assoc
@code{sloppy-assq}, @code{sloppy-assv} and @code{sloppy-assoc} behave @code{sloppy-assq}, @code{sloppy-assv} and @code{sloppy-assoc} behave
like the corresponding non-@code{sloppy-} procedures, except that they like the corresponding non-@code{sloppy-} procedures, except that they
@ -4611,6 +4770,7 @@ table into an a-list of key-value pairs.
@node Vectors @node Vectors
@section Vectors @section Vectors
@r5index make-vector
@c docstring begin (texi-doc-string "guile" "make-vector") @c docstring begin (texi-doc-string "guile" "make-vector")
@deffn primitive make-vector k [fill] @deffn primitive make-vector k [fill]
Returns a newly allocated vector of @var{k} elements. If a second Returns a newly allocated vector of @var{k} elements. If a second
@ -4618,6 +4778,8 @@ argument is given, then each element is initialized to @var{fill}.
Otherwise the initial contents of each element is unspecified. (r5rs) Otherwise the initial contents of each element is unspecified. (r5rs)
@end deffn @end deffn
@r5index vector
@r5index list->vector
@c docstring begin (texi-doc-string "guile" "vector") @c docstring begin (texi-doc-string "guile" "vector")
@c docstring begin (texi-doc-string "guile" "list->vector") @c docstring begin (texi-doc-string "guile" "list->vector")
@deffn primitive vector . l @deffn primitive vector . l
@ -4630,6 +4792,7 @@ arguments. Analogous to @samp{list}. (r5rs)
@end format @end format
@end deffn @end deffn
@r5index vector->list
@c docstring begin (texi-doc-string "guile" "vector->list") @c docstring begin (texi-doc-string "guile" "vector->list")
@deffn primitive vector->list v @deffn primitive vector->list v
@samp{Vector->list} returns a newly allocated list of the objects contained @samp{Vector->list} returns a newly allocated list of the objects contained
@ -4644,17 +4807,52 @@ list->vector '(dididit dah))
@end format @end format
@end deffn @end deffn
@r5index vector-fill!
@c FIXME::martin: Argument names
@c docstring begin (texi-doc-string "guile" "vector-fill!") @c docstring begin (texi-doc-string "guile" "vector-fill!")
@deffn primitive vector-fill! v fill_x @deffn primitive vector-fill! v fill_x
Stores @var{fill} in every element of @var{vector}. Stores @var{fill} in every element of @var{vector}.
The value returned by @samp{vector-fill!} is unspecified. (r5rs) The value returned by @samp{vector-fill!} is unspecified. (r5rs)
@end deffn @end deffn
@r5index vector?
@c docstring begin (texi-doc-string "guile" "vector?") @c docstring begin (texi-doc-string "guile" "vector?")
@deffn primitive vector? obj @deffn primitive vector? obj
Returns @t{#t} if @var{obj} is a vector, otherwise returns @t{#f}. (r5rs) Returns @t{#t} if @var{obj} is a vector, otherwise returns @t{#f}. (r5rs)
@end deffn @end deffn
@r5index vector-length
@deffn primitive vector-length vector
Returns the number of elements in @var{vector} as an exact integer.
@end deffn
@r5index vector-ref
@deffn primitive vector-ref vector k
@var{k} must be a valid index of @var{vector}.
@samp{Vector-ref} returns the contents of element @var{k} of
@var{vector}.
@lisp
(vector-ref '#(1 1 2 3 5 8 13 21) 5) @result{} 8
(vector-ref '#(1 1 2 3 5 8 13 21)
(let ((i (round (* 2 (acos -1)))))
(if (inexact? i)
(inexact->exact i)
i))) @result{} 13
@end lisp
@end deffn
@r5index vector-set!
@deffn primitive vector-set! vector k obj
@var{k} must be a valid index of @var{vector}.
@code{Vector-set!} stores @var{obj} in element @var{k} of @var{vector}.
The value returned by @samp{vector-set!} is unspecified.
@lisp
(let ((vec (vector 0 '(2 2 2 2) "Anna")))
(vector-set! vec 1 '("Sue" "Sue"))
vec) @result{} #(0 ("Sue" "Sue") "Anna")
(vector-set! '#(0 1 2) 1 "doe") @result{} @emph{error} ; constant vector
@end lisp
@end deffn
@node Hooks @node Hooks
@section Hooks @section Hooks

View file

@ -72,6 +72,7 @@ this procedure directly, use the procedures @code{read-enable},
@code{read-disable}, @code{read-set!} and @var{read-options}. @code{read-disable}, @code{read-set!} and @var{read-options}.
@end deffn @end deffn
@r5index read
@c docstring begin (texi-doc-string "guile" "read") @c docstring begin (texi-doc-string "guile" "read")
@deffn primitive read [port] @deffn primitive read [port]
Read an s-expression from the input port @var{port}, or from Read an s-expression from the input port @var{port}, or from
@ -83,6 +84,7 @@ Any whitespace before the next token is discarded.
@node Fly Evaluation @node Fly Evaluation
@section Procedures for On the Fly Evaluation @section Procedures for On the Fly Evaluation
@r5index eval
@c ARGFIXME environment/environment specifier @c ARGFIXME environment/environment specifier
@c docstring begin (texi-doc-string "guile" "eval") @c docstring begin (texi-doc-string "guile" "eval")
@deffn primitive eval exp environment @deffn primitive eval exp environment
@ -90,6 +92,7 @@ Evaluate @var{exp}, a list representing a Scheme expression, in the
environment given by @var{environment specifier}. environment given by @var{environment specifier}.
@end deffn @end deffn
@r5index interaction-environment
@c docstring begin (texi-doc-string "guile" "interaction-environment") @c docstring begin (texi-doc-string "guile" "interaction-environment")
@deffn primitive interaction-environment @deffn primitive interaction-environment
This procedure returns a specifier for the environment that contains This procedure returns a specifier for the environment that contains
@ -117,6 +120,13 @@ Note: Rather than do new consing, @code{apply:nconc2last}
destroys its argument, so use with care. destroys its argument, so use with care.
@end deffn @end deffn
@r5index apply
@deffn primitive apply proc arg1 @dots{} args
@var{proc} must be a procedure and @var{args} must be a list. Call
@var{proc} with the elements of the list @code{(append (list @var{arg1}
@dots{}) @var{args})} as the actual arguments.
@end deffn
@deffn primitive primitive-eval exp @deffn primitive primitive-eval exp
Evaluate @var{exp} in the top-level environment specified by Evaluate @var{exp} in the top-level environment specified by
the current module. the current module.
@ -141,6 +151,15 @@ signalled.
@node Loading @node Loading
@section Loading Scheme Code from File @section Loading Scheme Code from File
@r5index load
@deffn procedure load filename
Load @var{file} and evaluate its contents in the top-level environment.
The load paths are searched. If the variable @code{%load-hook} is
defined, it should be bound to a procedure that will be called before
any code is loaded. See documentation for @code{%load-hook} later in
this section.
@end deffn
@c ARGFIXME file/filename @c ARGFIXME file/filename
@c docstring begin (texi-doc-string "guile" "primitive-load") @c docstring begin (texi-doc-string "guile" "primitive-load")
@deffn primitive primitive-load filename @deffn primitive primitive-load filename
@ -213,6 +232,7 @@ 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,,,r4rs.info,The Revised^4 Report on Scheme}).
@end deffn @end deffn
@r5index force
@c docstring begin (texi-doc-string "guile" "force") @c docstring begin (texi-doc-string "guile" "force")
@deffn primitive force x @deffn primitive force x
If the promise X has not been computed yet, compute and return If the promise X has not been computed yet, compute and return

View file

@ -32,6 +32,7 @@ Because this definition is so loose, it is easy to write functions
that simulate ports in software. @dfn{Soft ports} and @dfn{string that simulate ports in software. @dfn{Soft ports} and @dfn{string
ports} are two interesting and powerful examples of this technique. ports} are two interesting and powerful examples of this technique.
@r5index input-port?
@c docstring begin (texi-doc-string "guile" "input-port?") @c docstring begin (texi-doc-string "guile" "input-port?")
@deffn primitive input-port? x @deffn primitive input-port? x
Returns @code{#t} if @var{x} is an input port, otherwise returns Returns @code{#t} if @var{x} is an input port, otherwise returns
@ -39,6 +40,7 @@ Returns @code{#t} if @var{x} is an input port, otherwise returns
@code{port?}. @code{port?}.
@end deffn @end deffn
@r5index output-port?
@c docstring begin (texi-doc-string "guile" "output-port?") @c docstring begin (texi-doc-string "guile" "output-port?")
@deffn primitive output-port? x @deffn primitive output-port? x
Returns @code{#t} if @var{x} is an output port, otherwise returns Returns @code{#t} if @var{x} is an output port, otherwise returns
@ -58,12 +60,14 @@ Equivalent to @code{(or (input-port? X) (output-port? X))}.
[Generic procedures for reading from ports.] [Generic procedures for reading from ports.]
@r5index eof-object?
@c docstring begin (texi-doc-string "guile" "eof-object?") @c docstring begin (texi-doc-string "guile" "eof-object?")
@deffn primitive eof-object? x @deffn primitive eof-object? x
Returns @code{#t} if @var{x} is an end-of-file object; otherwise Returns @code{#t} if @var{x} is an end-of-file object; otherwise
returns @code{#f}. returns @code{#f}.
@end deffn @end deffn
@r5index char-ready?
@c docstring begin (texi-doc-string "guile" "char-ready?") @c docstring begin (texi-doc-string "guile" "char-ready?")
@deffn primitive char-ready? [port] @deffn primitive char-ready? [port]
Returns @code{#t} if a character is ready on input @var{port} and Returns @code{#t} if a character is ready on input @var{port} and
@ -81,6 +85,7 @@ indistinguishable from an interactive port that has no ready
characters.} characters.}
@end deffn @end deffn
@r5index read-char?
@c docstring begin (texi-doc-string "guile" "read-char") @c docstring begin (texi-doc-string "guile" "read-char")
@deffn primitive read-char [port] @deffn primitive read-char [port]
Returns the next character available from @var{port}, updating Returns the next character available from @var{port}, updating
@ -88,6 +93,7 @@ Returns the next character available from @var{port}, updating
characters are available, an end-of-file object is returned. characters are available, an end-of-file object is returned.
@end deffn @end deffn
@r5index peek-char?
@c docstring begin (texi-doc-string "guile" "peek-char") @c docstring begin (texi-doc-string "guile" "peek-char")
@deffn primitive peek-char [port] @deffn primitive peek-char [port]
Returns the next character available from @var{port}, Returns the next character available from @var{port},
@ -195,6 +201,7 @@ Return the print state of the port @var{port}. If @var{port}
has no associated print state, @code{#f} is returned. has no associated print state, @code{#f} is returned.
@end deffn @end deffn
@r5index newline
@c docstring begin (texi-doc-string "guile" "newline") @c docstring begin (texi-doc-string "guile" "newline")
@deffn primitive newline [port] @deffn primitive newline [port]
Send a newline to @var{port}. Send a newline to @var{port}.
@ -228,6 +235,7 @@ port, if @var{destination} is @code{#f}, then return a string
containing the formatted text. Does not add a trailing newline. containing the formatted text. Does not add a trailing newline.
@end deffn @end deffn
@r5index write-char
@c docstring begin (texi-doc-string "guile" "write-char") @c docstring begin (texi-doc-string "guile" "write-char")
@deffn primitive write-char chr [port] @deffn primitive write-char chr [port]
Send character @var{chr} to @var{port}. Send character @var{chr} to @var{port}.
@ -265,6 +273,7 @@ See also @ref{Ports and File Descriptors, close}, for a procedure
which can close file descriptors. which can close file descriptors.
@end deffn @end deffn
@r5index close-input-port
@c docstring begin (texi-doc-string "guile" "close-input-port") @c docstring begin (texi-doc-string "guile" "close-input-port")
@deffn primitive close-input-port port @deffn primitive close-input-port port
Close the specified input port object. The routine has no effect if Close the specified input port object. The routine has no effect if
@ -275,6 +284,7 @@ See also @ref{Ports and File Descriptors, close}, for a procedure
which can close file descriptors. which can close file descriptors.
@end deffn @end deffn
@r5index close-output-port
@c docstring begin (texi-doc-string "guile" "close-output-port") @c docstring begin (texi-doc-string "guile" "close-output-port")
@deffn primitive close-output-port port @deffn primitive close-output-port port
Close the specified output port object. The routine has no effect if Close the specified output port object. The routine has no effect if
@ -492,6 +502,7 @@ If omitted, @var{port} defaults to the current output port.
@node Default Ports @node Default Ports
@section Default Ports for Input, Output and Errors @section Default Ports for Input, Output and Errors
@r5index current-input-port
@c docstring begin (texi-doc-string "guile" "current-input-port") @c docstring begin (texi-doc-string "guile" "current-input-port")
@deffn primitive current-input-port @deffn primitive current-input-port
Return the current input port. This is the default port used Return the current input port. This is the default port used
@ -499,6 +510,7 @@ by many input procedures. Initially, @code{current-input-port}
returns the @dfn{standard input} in Unix and C terminology. returns the @dfn{standard input} in Unix and C terminology.
@end deffn @end deffn
@r5index current-output-port
@c docstring begin (texi-doc-string "guile" "current-output-port") @c docstring begin (texi-doc-string "guile" "current-output-port")
@deffn primitive current-output-port @deffn primitive current-output-port
Return the current output port. This is the default port used Return the current output port. This is the default port used
@ -600,6 +612,7 @@ If a file cannot be opened with the access requested,
@code{open-file} throws an exception. @code{open-file} throws an exception.
@end deffn @end deffn
@r5index open-input-file
@c begin (scm-doc-string "r4rs.scm" "open-input-file") @c begin (scm-doc-string "r4rs.scm" "open-input-file")
@deffn procedure open-input-file filename @deffn procedure open-input-file filename
Open @var{filename} for input. Equivalent to Open @var{filename} for input. Equivalent to
@ -608,6 +621,7 @@ Open @var{filename} for input. Equivalent to
@end smalllisp @end smalllisp
@end deffn @end deffn
@r5index open-output-file
@c begin (scm-doc-string "r4rs.scm" "open-output-file") @c begin (scm-doc-string "r4rs.scm" "open-output-file")
@deffn procedure open-output-file filename @deffn procedure open-output-file filename
Open @var{filename} for output. Equivalent to Open @var{filename} for output. Equivalent to
@ -616,6 +630,75 @@ Open @var{filename} for output. Equivalent to
@end smalllisp @end smalllisp
@end deffn @end deffn
@r5index 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
procedures call @var{proc} with one argument: the port obtained by
opening the named file for input or output. If the file cannot be
opened, an error is signalled. If the procedure returns, then the port
is closed automatically and the value yielded by the procedure is
returned. If the procedure does not return, then the port will not be
closed automatically unless it is possible to prove that the port will
never again be used for a read or write operation.
@end deffn
@r5index 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
already exists. These procedures call @var{proc} with one argument: the
port obtained by opening the named file for input or output. If the
file cannot be opened, an error is signalled. If the procedure returns,
then the port is closed automatically and the value yielded by the
procedure is returned. If the procedure does not return, then the port
will not be closed automatically unless it is possible to prove that the
port will never again be used for a read or write operation.
@end deffn
@r5index 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
for input, an input port connected to it is made the default value
returned by @code{current-input-port}, and the @var{thunk} is called
with no arguments. When the @var{thunk} returns, the port is closed and
the previous default is restored. Returns the value yielded by
@var{thunk}. If an escape procedure is used to escape from the
continuation of these procedures, their behavior is implementation
dependent.
@end deffn
@r5index 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
exists. The file is opened for output, an output port connected to it
is made the default value returned by @code{current-output-port}, and
the @var{thunk} is called with no arguments. When the @var{thunk}
returns, the port is closed and the previous default is restored.
Returns the value yielded by @var{thunk}. If an escape procedure is
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
exists. The file is opened for output, an output port connected to it
is made the default value returned by @code{current-error-port}, and the
@var{thunk} is called with no arguments. When the @var{thunk} returns,
the port is closed and the previous default is restored. Returns the
value yielded by @var{thunk}. If an escape procedure is used to escape
from the continuation of these procedures, their behavior is
implementation dependent.
@end deffn
@c docstring begin (texi-doc-string "guile" "port-mode") @c docstring begin (texi-doc-string "guile" "port-mode")
@deffn primitive port-mode port @deffn primitive port-mode port
Returns the port modes associated with the open port @var{port}. These Returns the port modes associated with the open port @var{port}. These

View file

@ -56,6 +56,7 @@ documentation for that procedure.
Return @code{#t} if @var{obj} is a closure. Return @code{#t} if @var{obj} is a closure.
@end deffn @end deffn
@r5index procedure?
@c docstring begin (texi-doc-string "guile" "procedure?") @c docstring begin (texi-doc-string "guile" "procedure?")
@deffn primitive procedure? obj @deffn primitive procedure? obj
Return @code{#t} if @var{obj} is a procedure. Return @code{#t} if @var{obj} is a procedure.

View file

@ -13,6 +13,9 @@
@node Equality @node Equality
@section Equality @section Equality
@r5index eq?
@r5index eqv?
@r5index equal?
@c docstring begin (texi-doc-string "guile" "eq?") @c docstring begin (texi-doc-string "guile" "eq?")
@deffn primitive eq? x y @deffn primitive eq? x y