add section on toplevel expansion to r6rs incompatibilities
[bpt/guile.git] / doc / ref / r6rs.texi
CommitLineData
845cbcfe
AW
1@c -*-texinfo-*-
2@c This is part of the GNU Guile Reference Manual.
3@c Copyright (C) 2010
4@c Free Software Foundation, Inc.
5@c See the file guile.texi for copying conditions.
6
7@node R6RS Support
8@section R6RS Support
9@cindex R6RS
10
11@xref{R6RS Libraries}, for more information on how to define R6RS libraries, and
12their integration with Guile modules.
13
14@menu
15* R6RS Incompatibilities:: Guile mostly implements R6RS.
16* R6RS Standard Libraries:: Modules defined by the R6RS.
17@end menu
18
19@node R6RS Incompatibilities
20@subsection Incompatibilities with the R6RS
21
ea28e981
JG
22There are some incompatibilities between Guile and the R6RS. Some of
23them are intentional, some of them are bugs, and some are simply
24unimplemented features. Please let the Guile developers know if you
25find one that is not on this list.
845cbcfe
AW
26
27@itemize
845cbcfe 28@item
ea28e981
JG
29The R6RS specifies many situations in which a conforming implementation
30must signal a specific error. Guile doesn't really care about that too
5b379729 31much---if a correct R6RS program would not hit that error, we don't
ea28e981 32bother checking for it.
845cbcfe
AW
33
34@item
ea28e981
JG
35Multiple @code{library} forms in one file are not yet supported. This
36is because the expansion of @code{library} sets the current module, but
37does not restore it. This is a bug.
845cbcfe 38
bfccdcd5 39@item
ea28e981 40A @code{set!} to a variable transformer may only expand to an
5b379729 41expression, not a definition---even if the original @code{set!}
ea28e981 42expression was in definition context.
08fc523b
AW
43
44@item
45Instead of using the algorithm detailed in chapter 10 of the R6RS,
46expansion of toplevel forms happens sequentially.
47
48For example, while the expansion of the following set of recursive
49nested definitions does do the correct thing:
50
51@example
52(let ()
53 (define even?
54 (lambda (x)
55 (or (= x 0) (odd? (- x 1)))))
56 (define-syntax odd?
57 (syntax-rules ()
58 ((odd? x) (not (even? x)))))
59 (even? 10))
60@result{} #t
61@end example
62
63@noindent
64The same definitions at the toplevel do not:
65
66@example
67(begin
68 (define even?
69 (lambda (x)
70 (or (= x 0) (odd? (- x 1)))))
71 (define-syntax odd?
72 (syntax-rules ()
73 ((odd? x) (not (even? x)))))
74 (even? 10))
75<unnamed port>:4:18: In procedure even?:
76<unnamed port>:4:18: Wrong type to apply: #<syntax-transformer odd?>
77@end example
78
79This is because when expanding the right-hand-side of @code{even?}, the
80reference to @code{odd?} is not yet marked as a syntax transformer, so
81it is assumed to be a function.
82
83While it is likely that we can fix the case of toplevel forms nested in
84a @code{begin} or a @code{library} form, a fix for toplevel programs
85seems trickier to implement in a backward-compatible way. Suggestions
86and/or patches would be appreciated.
bfccdcd5 87@end itemize
845cbcfe
AW
88
89@node R6RS Standard Libraries
90@subsection R6RS Standard Libraries
91
ea28e981
JG
92In contrast with earlier versions of the Revised Report, the R6RS
93organizes the procedures and syntactic forms required of conforming
94implementations into a set of ``standard libraries'' which can be
95imported as necessary by user programs and libraries. Here we briefly
96list the libraries that have been implemented for Guile.
97
98We do not attempt to document these libraries fully here, as most of
99their functionality is already available in Guile itself. The
100expectation is that most Guile users will use the well-known and
101well-documented Guile modules. These R6RS libraries are mostly useful
102to users who want to port their code to other R6RS systems.
103
104The documentation in the following sections reproduces some of the
105content of the library section of the Report, but is mostly intended to
106provide supplementary information about Guile's implementation of the
107R6RS standard libraries. For complete documentation, design rationales
108and further examples, we advise you to consult the ``Standard
109Libraries'' section of the Report (@pxref{Standard Libraries,
110R6RS Standard Libraries,, r6rs, The Revised^6 Report on the Algorithmic
111Language Scheme}).
112
113@menu
114* Library Usage:: What to know about Guile's library support.
115* rnrs base:: The base library.
116* rnrs unicode:: Access to Unicode operations.
117* rnrs bytevectors:: Functions for working with binary data.
118* rnrs lists:: List utilities.
119* rnrs sorting:: Sorting for lists and vectors.
120* rnrs control:: Additional control structures.
121
122* R6RS Records:: A note about R6RS records.
123* rnrs records syntactic:: Syntactic API for R6RS records.
124* rnrs records procedural:: Procedural API for R6RS records.
125* rnrs records inspection:: Reflection on R6RS records.
126
127* rnrs exceptions:: Handling exceptional situations.
128* rnrs conditions:: Data structures for exceptions.
129
130* I/O Conditions:: Predefined I/O error types.
131* rnrs io ports:: Support for port-based I/O.
132* rnrs io simple:: High-level I/O API.
133
134* rnrs files:: Functions for working with files.
135* rnrs programs:: Functions for working with processes.
136* rnrs arithmetic fixnums:: Fixed-precision arithmetic operations.
137* rnrs arithmetic flonums:: Floating-point arithmetic operations.
138* rnrs arithmetic bitwise:: Exact bitwise arithmetic operations.
139* rnrs syntax-case:: Support for `syntax-case' macros.
140* rnrs hashtables:: Hashtables.
141* rnrs enums:: Enumerations.
142* rnrs:: The composite library.
143* rnrs eval:: Support for on-the-fly evaluation.
144* rnrs mutable-pairs:: Support for mutable pairs.
145* rnrs mutable-strings:: Support for mutable strings.
146* rnrs r5rs:: Compatibility layer for R5RS Scheme.
147
148@end menu
149
150@node Library Usage
151@subsubsection Library Usage
152
153Guile implements the R6RS `library' form as a transformation to a native
154Guile module definition. As a consequence of this, all of the libraries
155described in the following subsections, in addition to being available
156for use by R6RS libraries and top-level programs, can also be imported
5b379729
JG
157as if they were normal Guile modules---via a @code{use-modules} form,
158say. For example, the R6RS ``composite'' library can be imported by:
ea28e981
JG
159
160@lisp
161 (import (rnrs (6)))
162@end lisp
163
164@lisp
165 (use-modules ((rnrs) :version (6)))
166@end lisp
167
168For more information on Guile's library implementation, see
169(@pxref{R6RS Libraries}).
170
171@node rnrs base
172@subsubsection rnrs base
173
174The @code{(rnrs base (6))} library exports the procedures and syntactic
175forms described in the main section of the Report
176(@pxref{Base library, R6RS Base library,, r6rs,
177The Revised^6 Report on the Algorithmic Language Scheme}). They are
178grouped below by the existing manual sections to which they correspond.
179
180@deffn {Scheme Procedure} boolean? obj
181@deffnx {Scheme Procedure} not x
182@xref{Booleans}, for documentation.
183@end deffn
184
185@deffn {Scheme Procedure} symbol? obj
186@deffnx {Scheme Procedure} symbol->string sym
187@deffnx {Scheme Procedure} string->symbol str
188@xref{Symbol Primitives}, for documentation.
189@end deffn
190
191@deffn {Scheme Procedure} char? obj
192@deffnx {Scheme Procedure} char=?
193@deffnx {Scheme Procedure} char<?
194@deffnx {Scheme Procedure} char>?
195@deffnx {Scheme Procedure} char<=?
196@deffnx {Scheme Procedure} char>=?
197@deffnx {Scheme Procedure} integer->char n
198@deffnx {Scheme Procedure} char->integer chr
199@xref{Characters}, for documentation.
200@end deffn
201
202@deffn {Scheme Procedure} list? x
203@deffnx {Scheme Procedure} null? x
204@xref{List Predicates}, for documentation.
205@end deffn
206
207@deffn {Scheme Procedure} pair? x
208@deffnx {Scheme Procedure} cons x y
209@deffnx {Scheme Procedure} car pair
210@deffnx {Scheme Procedure} cdr pair
211@deffnx {Scheme Procedure} caar pair
212@deffnx {Scheme Procedure} cadr pair
213@deffnx {Scheme Procedure} cdar pair
214@deffnx {Scheme Procedure} cddr pair
215@deffnx {Scheme Procedure} caaar pair
216@deffnx {Scheme Procedure} caadr pair
217@deffnx {Scheme Procedure} cadar pair
218@deffnx {Scheme Procedure} cdaar pair
219@deffnx {Scheme Procedure} caddr pair
220@deffnx {Scheme Procedure} cdadr pair
221@deffnx {Scheme Procedure} cddar pair
222@deffnx {Scheme Procedure} cdddr pair
223@deffnx {Scheme Procedure} caaaar pair
224@deffnx {Scheme Procedure} caaadr pair
225@deffnx {Scheme Procedure} caadar pair
226@deffnx {Scheme Procedure} cadaar pair
227@deffnx {Scheme Procedure} cdaaar pair
228@deffnx {Scheme Procedure} cddaar pair
229@deffnx {Scheme Procedure} cdadar pair
230@deffnx {Scheme Procedure} cdaadr pair
231@deffnx {Scheme Procedure} cadadr pair
232@deffnx {Scheme Procedure} caaddr pair
233@deffnx {Scheme Procedure} caddar pair
234@deffnx {Scheme Procedure} cadddr pair
235@deffnx {Scheme Procedure} cdaddr pair
236@deffnx {Scheme Procedure} cddadr pair
237@deffnx {Scheme Procedure} cdddar pair
238@deffnx {Scheme Procedure} cddddr pair
239@xref{Pairs}, for documentation.
240@end deffn
241
242@deffn {Scheme Procedure} number? obj
243@xref{Numerical Tower}, for documentation.
244@end deffn
245
246@deffn {Scheme Procedure} string? obj
247@xref{String Predicates}, for documentation.
248@end deffn
249
250@deffn {Scheme Procedure} procedure? obj
251@xref{Procedure Properties}, for documentation.
252@end deffn
253
254@deffn {Scheme Syntax} define name value
255@deffnx {Scheme Syntax} set! variable-name value
256@xref{Definition}, for documentation.
257@end deffn
258
259@deffn {Scheme Syntax} define-syntax keyword expression
260@deffnx {Scheme Syntax} let-syntax ((keyword transformer) ...) exp ...
261@deffnx {Scheme Syntax} letrec-syntax ((keyword transformer) ...) exp ...
262@xref{Defining Macros}, for documentation.
263@end deffn
264
265@deffn {Scheme Syntax} identifier-syntax exp
266@xref{Identifier Macros}, for documentation.
267@end deffn
268
269@deffn {Scheme Syntax} syntax-rules literals (pattern template) ...
270@xref{Syntax Rules}, for documentation.
271@end deffn
272
273@deffn {Scheme Syntax} lambda formals body
274@xref{Lambda}, for documentation.
275@end deffn
276
277@deffn {Scheme Syntax} let bindings body
278@deffnx {Scheme Syntax} let* bindings body
279@deffnx {Scheme Syntax} letrec bindings body
935c7aca 280@deffnx {Scheme Syntax} letrec* bindings body
ea28e981
JG
281@xref{Local Bindings}, for documentation.
282@end deffn
283
284@deffn {Scheme Syntax} let-values bindings body
285@deffnx {Scheme Syntax} let*-values bindings body
286@xref{SRFI-11}, for documentation.
287@end deffn
288
289@deffn {Scheme Syntax} begin expr1 expr2 ...
290@xref{begin}, for documentation.
291@end deffn
292
293@deffn {Scheme Syntax} quote expr
294@deffnx {Scheme Syntax} quasiquote expr
295@deffnx {Scheme Syntax} unquote expr
296@deffnx {Scheme Syntax} unquote-splicing expr
297@xref{Expression Syntax}, for documentation.
298@end deffn
299
300@deffn {Scheme Syntax} if test consequence [alternate]
301@deffnx {Scheme Syntax} cond clause1 clause2 ...
302@deffnx {Scheme Syntax} case key clause1 clause2 ...
303@xref{if cond case}, for documentation.
304@end deffn
305
306@deffn {Scheme Syntax} and expr ...
307@deffnx {Scheme Syntax} or expr ...
308@xref{and or}, for documentation.
309@end deffn
310
311@deffn {Scheme Procedure} eq? x y
312@deffnx {Scheme Procedure} eqv? x y
313@deffnx {Scheme Procedure} equal? x y
314@deffnx {Scheme Procedure} symbol=? symbol1 symbol2 ...
315@xref{Equality}, for documentation.
316
317@code{symbol=?} is identical to @code{eq?}.
318@end deffn
319
320@deffn {Scheme Procedure} complex? z
321@xref{Complex Numbers}, for documentation.
322@end deffn
323
324@deffn {Scheme Procedure} real-part z
325@deffnx {Scheme Procedure} imag-part z
326@deffnx {Scheme Procedure} make-rectangular real_part imaginary_part
327@deffnx {Scheme Procedure} make-polar x y
328@deffnx {Scheme Procedure} magnitude z
329@deffnx {Scheme Procedure} angle z
330@xref{Complex}, for documentation.
331@end deffn
332
333@deffn {Scheme Procedure} sqrt z
334@deffnx {Scheme Procedure} exp z
335@deffnx {Scheme Procedure} expt z1 z2
336@deffnx {Scheme Procedure} log z
337@deffnx {Scheme Procedure} sin z
338@deffnx {Scheme Procedure} cos z
339@deffnx {Scheme Procedure} tan z
340@deffnx {Scheme Procedure} asin z
341@deffnx {Scheme Procedure} acos z
342@deffnx {Scheme Procedure} atan z
343@xref{Scientific}, for documentation.
344@end deffn
345
346@deffn {Scheme Procedure} real? x
347@deffnx {Scheme Procedure} rational? x
348@deffnx {Scheme Procedure} nan? x
349@deffnx {Scheme Procedure} numerator x
350@deffnx {Scheme Procedure} denominator x
351@deffnx {Scheme Procedure} rationalize x eps
352@xref{Reals and Rationals}, for documentation.
353@end deffn
354
355@deffn {Scheme Procedure} exact? x
356@deffnx {Scheme Procedure} inexact? x
357@deffnx {Scheme Procedure} exact z
358@deffnx {Scheme Procedure} inexact z
359@xref{Exactness}, for documentation. The @code{exact} and
360@code{inexact} procedures are identical to the @code{inexact->exact} and
361@code{exact->inexact} procedures provided by Guile's code library.
362@end deffn
363
364@deffn {Scheme Procedure} integer? x
365@xref{Integers}, for documentation.
366@end deffn
367
368@deffn {Scheme Procedure} odd? n
369@deffnx {Scheme Procedure} even? n
370@deffnx {Scheme Procedure} gcd x ...
371@deffnx {Scheme Procedure} lcm x ...
372@xref{Integer Operations}, for documentation.
373@end deffn
374
375@deffn {Scheme Procedure} =
376@deffnx {Scheme Procedure} <
377@deffnx {Scheme Procedure} >
378@deffnx {Scheme Procedure} <=
379@deffnx {Scheme Procedure} >=
380@deffnx {Scheme Procedure} zero? x
381@deffnx {Scheme Procedure} positive? x
382@deffnx {Scheme Procedure} negative? x
383@xref{Comparison}, for documentation.
384@end deffn
385
5b379729 386@deffn {Scheme Procedure} for-each f lst1 lst2 ...
ea28e981
JG
387@xref{SRFI-1 Fold and Map}, for documentation.
388@end deffn
389
390@deffn {Scheme Procedure} list elem1 ... elemN
391@xref{List Constructors}, for documentation.
392@end deffn
393
394@deffn {Scheme Procedure} length lst
395@deffnx {Scheme Procedure} list-ref lst k
396@deffnx {Scheme Procedure} list-tail lst k
397@xref{List Selection}, for documentation.
398@end deffn
399
400@deffn {Scheme Procedure} append lst1 ... lstN
401@deffnx {Scheme Procedure} reverse lst
402@xref{Append/Reverse}, for documentation.
403@end deffn
404
405@deffn {Scheme Procedure} number->string n [radix]
406@deffnx {Scheme Procedure} string->number str [radix]
407@xref{Conversion}, for documentation.
408@end deffn
409
410@deffn {Scheme Procedure} string char ...
411@deffnx {Scheme Procedure} make-string k [chr]
412@deffnx {Scheme Procedure} list->string lst
413@xref{String Constructors}, for documentation.
414@end deffn
415
416@deffn {Scheme Procedure} string->list str [start [end]]
417@xref{List/String Conversion}, for documentation.
418@end deffn
419
420@deffn {Scheme Procedure} string-length str
421@deffnx {Scheme Procedure} string-ref str k
422@deffnx {Scheme Procedure} string-copy str [start [end]]
423@deffnx {Scheme Procedure} substring str start [end]
424@xref{String Selection}, for documentation.
425@end deffn
426
427@deffn {Scheme Procedure} string=? [s1 [s2 . rest]]
428@deffnx {Scheme Procedure} string<? [s1 [s2 . rest]]
429@deffnx {Scheme Procedure} string>? [s1 [s2 . rest]]
430@deffnx {Scheme Procedure} string<=? [s1 [s2 . rest]]
431@deffnx {Scheme Procedure} string>=? [s1 [s2 . rest]]
432@xref{String Comparison}, for documentation.
433@end deffn
434
435@deffn {Scheme Procedure} string-append . args
436@xref{Reversing and Appending Strings}, for documentation.
437@end deffn
438
439@deffn {Scheme Procedure} string-for-each proc s [start [end]]
440@xref{Mapping Folding and Unfolding}, for documentation.
441@end deffn
442
443@deffn {Scheme Procedure} + z1 ...
444@deffnx {Scheme Procedure} - z1 z2 ...
445@deffnx {Scheme Procedure} * z1 ...
446@deffnx {Scheme Procedure} / z1 z2 ...
447@deffnx {Scheme Procedure} max x1 x2 ...
448@deffnx {Scheme Procedure} min x1 x2 ...
449@deffnx {Scheme Procedure} abs x
450@deffnx {Scheme Procedure} truncate x
451@deffnx {Scheme Procedure} floor x
452@deffnx {Scheme Procedure} ceiling x
453@deffnx {Scheme Procedure} round x
454@xref{Arithmetic}, for documentation.
455@end deffn
456
457@deffn {Scheme Procedure} div x1 x2
458@deffnx {Scheme Procedure} mod x1 x2
459@deffnx {Scheme Procedure} div-and-mod x1 x2
460These procedures implement number-theoretic division.
461
462@code{div-and-mod} returns two values, the respective results of
463@code{(div x1 x2)} and @code{(mod x1 x2)}.
464@end deffn
465
466@deffn {Scheme Procedure} div0 x1 x2
467@deffnx {Scheme Procedure} mod0 x1 x2
468@deffnx {Scheme Procedure} div0-and-mod0 x1 x2
469These procedures are similar to @code{div}, @code{mod}, and
470@code{div-and-mod}, except that @code{mod0} returns values that lie
471within a half-open interval centered on zero.
472@end deffn
473
474@deffn {Scheme Procedure} exact-integer-sqrt k
475This procedure returns two nonnegative integer objects @code{s} and
476@code{r} such that k = s^2 + r and k < (s + 1)^2.
477@end deffn
478
479@deffn {Scheme Procedure} real-valued? obj
480@deffnx {Scheme Procedure} rational-valued? obj
481@deffnx {Scheme Procedure} integer-valued? obj
482These procedures return @code{#t} if and only if their arguments can,
483respectively, be coerced to a real, rational, or integer value without a
484loss of numerical precision.
485
486@code{real-valued?} will return @code{#t} for complex numbers whose
487imaginary parts are zero.
488@end deffn
489
490@deffn {Scheme Procedure} finite? x
491@deffnx {Scheme Procedure} infinite? x
492@code{infinite?} returns @code{#t} if @var{x} is an infinite value,
493@code{#f} otherwise. @code{finite?} returns the negation of
494@code{infinite?}.
495@end deffn
496
497@deffn {Scheme Syntax} assert expr
498Raises an @code{&assertion} condition if @var{expr} evaluates to
499@code{#f}; otherwise evaluates to the value of @var{expr}.
500@end deffn
501
502@deffn {Scheme Procedure} error who message irritant1 ...
503@deffnx {Scheme Procedure} assertion-violation who message irritant1 ...
504These procedures raise compound conditions based on their arguments:
505If @var{who} is not @code{#f}, the condition will include a @code{&who}
506condition whose @code{who} field is set to @var{who}; a @code{&message}
507condition will be included with a @code{message} field equal to
508@var{message}; an @code{&irritants} condition will be included with its
509@code{irritants} list given by @code{irritant1 ...}.
510
511@code{error} produces a compound condition with the simple conditions
512described above, as well as an @code{&error} condition;
513@code{assertion-violation} produces one that includes an
514@code{&assertion} condition.
515@end deffn
516
517@deffn {Scheme Procedure} vector-map proc v
518@deffnx {Scheme Procedure} vector-for-each proc v
519These procedures implement the @code{map} and @code{for-each} contracts
520over vectors.
521@end deffn
522
523@deffn {Scheme Procedure} vector . l
524@deffnx {Scheme Procedure} vector? obj
525@deffnx {Scheme Procedure} make-vector len
526@deffnx {Scheme Procedure} make-vector len fill
527@deffnx {Scheme Procedure} list->vector l
528@deffnx {Scheme Procedure} vector->list v
529@xref{Vector Creation}, for documentation.
530@end deffn
531
532@deffn {Scheme Procedure} vector-length vector
533@deffnx {Scheme Procedure} vector-ref vector k
534@deffnx {Scheme Procedure} vector-set! vector k obj
535@deffnx {Scheme Procedure} vector-fill! v fill
536@xref{Vector Accessors}, for documentation.
537@end deffn
538
539@deffn {Scheme Procedure} call-with-current-continuation proc
540@deffnx {Scheme Procedure} call/cc proc
541@xref{Continuations}, for documentation.
542@end deffn
543
544@deffn {Scheme Procedure} values arg1 ... argN
545@deffnx {Scheme Procedure} call-with-values producer consumer
546@xref{Multiple Values}, for documentation.
547@end deffn
548
549@deffn {Scheme Procedure} dynamic-wind in_guard thunk out_guard
550@xref{Dynamic Wind}, for documentation.
551@end deffn
552
553@deffn {Scheme Procedure} apply proc arg1 ... argN arglst
554@xref{Fly Evaluation}, for documentation.
555@end deffn
556
557@node rnrs unicode
558@subsubsection rnrs unicode
559
560The @code{(rnrs unicode (6))} library provides procedures for
561manipulating Unicode characters and strings.
562
563@deffn {Scheme Procedure} char-upcase char
564@deffnx {Scheme Procedure} char-downcase char
565@deffnx {Scheme Procedure} char-titlecase char
566@deffnx {Scheme Procedure} char-foldcase char
567These procedures translate their arguments from one Unicode character
568set to another. @code{char-upcase}, @code{char-downcase}, and
569@code{char-titlecase} are identical to their counterparts in the
5b379729 570Guile core library; @xref{Characters}, for documentation.
ea28e981
JG
571
572@code{char-foldcase} returns the result of applying @code{char-upcase}
5b379729 573to its argument, followed by @code{char-downcase}---except in the case
ea28e981
JG
574of the Turkic characters @code{U+0130} and @code{U+0131}, for which the
575procedure acts as the identity function.
576@end deffn
577
578@deffn {Scheme Procedure} char-ci=? char1 char2 char3 ...
579@deffnx {Scheme Procedure} char-ci<? char1 char2 char3 ...
580@deffnx {Scheme Procedure} char-ci>? char1 char2 char3 ...
581@deffnx {Scheme Procedure} char-ci<=? char1 char2 char3 ...
582@deffnx {Scheme Procedure} char-ci>=? char1 char2 char3 ...
583These procedures facilitate case-insensitive comparison of Unicode
584characters. They are identical to the procedures provided by Guile's
585core library. @xref{Characters}, for documentation.
586@end deffn
587
588@deffn {Scheme Procedure} char-alphabetic? char
589@deffnx {Scheme Procedure} char-numeric? char
590@deffnx {Scheme Procedure} char-whitespace? char
591@deffnx {Scheme Procedure} char-upper-case? char
592@deffnx {Scheme Procedure} char-lower-case? char
593@deffnx {Scheme Procedure} char-title-case? char
594These procedures implement various Unicode character set predicates.
595They are identical to the procedures provided by Guile's core library.
596@xref{Characters}, for documentation.
597@end deffn
598
599@deffn {Scheme Procedure} char-general-category char
600@xref{Characters}, for documentation.
601@end deffn
602
603@deffn {Scheme Procedure} string-upcase string
604@deffnx {Scheme Procedure} string-downcase string
605@deffnx {Scheme Procedure} string-titlecase string
606@deffnx {Scheme Procedure} string-foldcase string
607These procedures perform Unicode case folding operations on their input.
608@xref{Alphabetic Case Mapping}, for documentation.
609@end deffn
610
611@deffn {Scheme Procedure} string-ci=? string1 string2 string3 ...
612@deffnx {Scheme Procedure} string-ci<? string1 string2 string3 ...
613@deffnx {Scheme Procedure} string-ci>? string1 string2 string3 ...
614@deffnx {Scheme Procedure} string-ci<=? string1 string2 string3 ...
615@deffnx {Scheme Procedure} string-ci>=? string1 string2 string3 ...
616These procedures perform case-insensitive comparison on their input.
617@xref{String Comparison}, for documentation.
618@end deffn
619
620@deffn {Scheme Procedure} string-normalize-nfd string
621@deffnx {Scheme Procedure} string-normalize-nfkd string
622@deffnx {Scheme Procedure} string-normalize-nfc string
623@deffnx {Scheme Procedure} string-normalize-nfkc string
624These procedures perform Unicode string normalization operations on
625their input. @xref{String Comparison}, for documentation.
626@end deffn
627
628@node rnrs bytevectors
629@subsubsection rnrs bytevectors
630
631The @code{(rnrs bytevectors (6))} library provides procedures for
632working with blocks of binary data. This functionality is documented
633in its own section of the manual; @xref{Bytevectors}.
634
635@node rnrs lists
636@subsubsection rnrs lists
637
638The @code{(rnrs lists (6))} library provides procedures additional
639procedures for working with lists.
640
641@deffn {Scheme Procedure} find proc list
642This procedure is identical to the one defined in Guile's SRFI-1
643implementation. @xref{SRFI-1 Searching}, for documentation.
644@end deffn
645
646@deffn {Scheme Procedure} for-all proc list1 list2 ...
647@deffnx {Scheme Procedure} exists proc list1 list2 ...
648
649The @code{for-all} procedure is identical to the @code{every} procedure
650defined by SRFI-1; the @code{exists} procedure is identical to SRFI-1's
651@code{any}. @xref{SRFI-1 Searching}, for documentation.
652@end deffn
653
654@deffn {Scheme Procedure} filter proc list
655@deffnx {Scheme Procedure} partition proc list
656These procedures are identical to the ones provided by SRFI-1.
657@xref{List Modification}, for a description of @code{filter};
5b379729 658@xref{SRFI-1 Filtering and Partitioning}, for @code{partition}.
ea28e981
JG
659@end deffn
660
661@deffn {Scheme Procedure} fold-left combine nil list1 list2 ... listn
662@deffnx {Scheme Procedure} fold-right combine nil list1 list2 ... listn
663These procedures are identical to the @code{fold} and @code{fold-right}
664procedures provided by SRFI-1. @xref{SRFI-1 Fold and Map}, for
665documentation.
666@end deffn
667
668@deffn {Scheme Procedure} remp proc list
669@deffnx {Scheme Procedure} remove obj list
670@deffnx {Scheme Procedure} remv obj list
671@deffnx {Scheme Procedure} remq obj list
672@code{remove}, @code{remv}, and @code{remq} are identical to the
673@code{delete}, @code{delv}, and @code{delq} procedures provided by
5b379729
JG
674Guile's core library, (@pxref{List Modification}). @code{remp} is
675identical to the alternate @code{remove} procedure provided by SRFI-1;
676@xref{SRFI-1 Deleting}.
ea28e981
JG
677@end deffn
678
679@deffn {Scheme Procedure} memp proc list
680@deffnx {Scheme Procedure} member obj list
681@deffnx {Scheme Procedure} memv obj list
682@deffnx {Scheme Procedure} memq obj list
683@code{member}, @code{memv}, and @code{memq} are identical to the
5b379729
JG
684procedures provided by Guile's core library; @xref{List Searching},
685for their documentation. @code{memp} uses the specified predicate
686function @code{proc} to test elements of the list @var{list}---it
ea28e981
JG
687behaves similarly to @code{find}, except that it returns the first
688sublist of @var{list} whose @code{car} satisfies @var{proc}.
689@end deffn
690
691@deffn {Scheme Procedure} assp proc alist
692@deffnx {Scheme Procedure} assoc obj alist
693@deffnx {Scheme Procedure} assv obj alist
694@deffnx {Scheme Procedure} assq obj alist
695@code{assoc}, @code{assv}, and @code{assq} are identical to the
696procedures provided by Guile's core library;
5b379729 697@xref{Alist Key Equality}, for their documentation. @code{assp} uses
ea28e981
JG
698the specified predicate function @code{proc} to test keys in the
699association list @var{alist}.
700@end deffn
701
702@deffn {Scheme Procedure} cons* obj1 ... obj
703@deffnx {Scheme Procedure} cons* obj
704This procedure is identical to the one exported by Guile's core
705library. @xref{List Constructors}, for documentation.
706@end deffn
707
708@node rnrs sorting
709@subsubsection rnrs sorting
710
711The @code{(rnrs sorting (6))} library provides procedures for sorting
712lists and vectors.
713
714@deffn {Scheme Procedure} list-sort proc list
715@deffnx {Scheme Procedure} vector-sort proc vector
716These procedures return their input sorted in ascending order, without
717modifying the original data. @var{proc} must be a procedure that takes
718two elements from the input list or vector as arguments, and returns a
719true value if the first is ``less'' than the second, @code{#f}
720otherwise. @code{list-sort} returns a list; @code{vector-sort} returns
721a vector.
722
723Both @code{list-sort} and @code{vector-sort} are implemented in terms of
724the @code{stable-sort} procedure from Guile's core library.
725@xref{Sorting}, for a discussion of the behavior of that procedure.
726@end deffn
727
728@deffn {Scheme Procedure} vector-sort! proc vector
729Performs a destructive, ``in-place'' sort of @var{vector}, using
730@var{proc} as described above to determine an ascending ordering of
731elements. @code{vector-sort!} returns an unspecified value.
732
733This procedure is implemented in terms of the @code{sort!} procedure
734from Guile's core library. @xref{Sorting}, for more information.
735@end deffn
736
737@node rnrs control
738@subsubsection rnrs control
739
740The @code{(rnrs control (6))} library provides syntactic forms useful
741for constructing conditional expressions and controlling the flow of
742execution.
743
744@deffn {Scheme Syntax} when test expression1 expression2 ...
745@deffnx {Scheme Syntax} unless test expression1 expression2 ...
746The @code{when} form is evaluated by evaluating the specified @var{test}
747expression; if the result is a true value, the @var{expression}s that
748follow it are evaluated in order, and the value of the final
749@var{expression} becomes the value of the entire @code{when} expression.
750
751The @code{unless} form behaves similarly, with the exception that the
752specified @var{expression}s are only evaluated if the value of
753@var{test} is false.
754@end deffn
755
756@deffn {Scheme Syntax} do ((variable init step) ...) (test expression ...) command ...
757This form is identical to the one provided by Guile's core library.
758@xref{while do}, for documentation.
759@end deffn
760
761@deffn {Scheme Syntax} case-lambda clause ...
762This form is identical to the one provided by Guile's core library.
763@xref{Case-lambda}, for documentation.
764@end deffn
765
766@node R6RS Records
767@subsubsection R6RS Records
768
769The manual sections below describe Guile's implementation of R6RS
770records, which provide support for user-defined data types. The R6RS
771records API provides a superset of the features provided by Guile's
772``native'' records, as well as those of the SRFI-9 records API;
5b379729 773@xref{Records}, and @ref{SRFI-9}, for a description of those
ea28e981
JG
774interfaces.
775
776As with SRFI-9 and Guile's native records, R6RS records are constructed
777using a record-type descriptor that specifies attributes like the
778record's name, its fields, and the mutability of those fields.
779
780R6RS records extend this framework to support single inheritance via the
781specification of a ``parent'' type for a record type at definition time.
782Accessors and mutator procedures for the fields of a parent type may be
783applied to records of a subtype of this parent. A record type may be
784@dfn{sealed}, in which case it cannot be used as the parent of another
785record type.
786
787The inheritance mechanism for record types also informs the process of
788initializing the fields of a record and its parents. Constructor
789procedures that generate new instances of a record type are obtained
790from a record constructor descriptor, which encapsulates the record-type
791descriptor of the record to be constructed along with a @dfn{protocol}
792procedure that defines how constructors for record subtypes delegate to
793the constructors of their parent types.
794
795A protocol is a procedure used by the record system at construction time
796to bind arguments to the fields of the record being constructed. The
797protocol procedure is passed a procedure @var{n} that accepts the
798arguments required to construct the record's parent type; this
799procedure, when invoked, will return a procedure @var{p} that accepts
800the arguments required to construct a new instance of the record type
801itself and returns a new instance of the record type.
802
803The protocol should in turn return a procedure that uses @var{n} and
804@var{p} to initialize the fields of the record type and its parent
805type(s). This procedure will be the constructor returned by
806
807As a trivial example, consider the hypothetical record type
808@code{pixel}, which encapsulates an x-y location on a screen, and
809@code{voxel}, which has @code{pixel} as its parent type and stores an
810additional coordinate. The following protocol produces a constructor
811procedure that accepts all three coordinates, uses the first two to
812initialize the fields of @code{pixel}, and binds the third to the single
813field of @code{voxel}.
814
815@lisp
816 (lambda (n)
817 (lambda (x y z)
818 (let ((p (n x y)))
819 (p z))))
820@end lisp
821
822It may be helpful to think of protocols as ``constructor factories''
823that produce chains of delegating constructors glued together by the
824helper procedure @var{n}.
825
826An R6RS record type may be declared to be @dfn{nongenerative} via the
5b379729
JG
827use of a unique generated or user-supplied symbol---or
828@dfn{uid}---such that subsequent record type declarations with the same
829uid and attributes will return the previously-declared record-type
830descriptor.
ea28e981
JG
831
832R6RS record types may also be declared to be @dfn{opaque}, in which case
833the various predicates and introspection procedures defined in
834@code{(rnrs records introspection)} will behave as if records of this
835type are not records at all.
836
837Note that while the R6RS records API shares much of its namespace with
838both the SRFI-9 and native Guile records APIs, it is not currently
839compatible with either.
840
841@node rnrs records syntactic
842@subsubsection rnrs records syntactic
843
844The @code{(rnrs records syntactic (6))} library exports the syntactic
845API for working with R6RS records.
846
847@deffn {Scheme Syntax} define-record-type name-spec record-clause*
848Defines a new record type, introducing bindings for a record-type
849descriptor, a record constructor descriptor, a constructor procedure,
850a record predicate, and accessor and mutator procedures for the new
851record type's fields.
852
853@var{name-spec} must either be an identifier or must take the form
854@code{(record-name constructor-name predicate-name)}, where
855@var{record-name}, @var{constructor-name}, and @var{predicate-name} are
856all identifiers and specify the names to which, respectively, the
857record-type descriptor, constructor, and predicate procedures will be
858bound. If @var{name-spec} is only an identifier, it specifies the name
859to which the generated record-type descriptor will be bound.
860
861Each @var{record-clause} must be one of the following:
862
863@itemize @bullet
864@item
865@code{(fields field-spec*)}, where each @var{field-spec} specifies a
866field of the new record type and takes one of the following forms:
867@itemize @bullet
868@item
869@code{(immutable field-name accessor-name)}, which specifies an
870immutable field with the name @var{field-name} and binds an accessor
871procedure for it to the name given by @var{accessor-name}
872@item
873@code{(mutable field-name accessor-name mutator-name)}, which specifies
874a mutable field with the name @var{field-name} and binds accessor and
875mutator procedures to @var{accessor-name} and @var{mutator-name},
876respectively
877@item
878@code{(immutable field-name)}, which specifies an immutable field with
879the name @var{field-name}; an accessor procedure for it will be created
880and named by appending record name and @var{field-name} with a hyphen
881separator
882@item
883@code{(mutable field-name}), which specifies a mutable field with the
884name @var{field-name}; an accessor procedure for it will be created and
885named as described above; a mutator procedure will also be created and
886named by appending @code{-set!} to the accessor name
887@item
888@code{field-name}, which specifies an immutable field with the name
889@var{field-name}; an access procedure for it will be created and named
890as described above
891@end itemize
892@item
893@code{(parent parent-name)}, where @var{parent-name} is a symbol giving
894the name of the record type to be used as the parent of the new record
895type
896@item
897@code{(protocol expression)}, where @var{expression} evaluates to a
898protocol procedure which behaves as described above, and is used to
899create a record constructor descriptor for the new record type
900@item
901@code{(sealed sealed?)}, where @var{sealed?} is a boolean value that
902specifies whether or not the new record type is sealed
903@item
904@code{(opaque opaque?)}, where @var{opaque?} is a boolean value that
905specifies whether or not the new record type is opaque
906@item
907@code{(nongenerative [uid])}, which specifies that the record type is
908nongenerative via the optional uid @var{uid}. If @var{uid} is not
909specified, a unique uid will be generated at expansion time
910@item
911@code{(parent-rtd parent-rtd parent-cd)}, a more explicit form of the
912@code{parent} form above; @var{parent-rtd} and @var{parent-cd} should
913evaluate to a record-type descriptor and a record constructor
914descriptor, respectively
915@end itemize
916@end deffn
917
918@deffn {Scheme Syntax} record-type-descriptor record-name
919Evaluates to the record-type descriptor associated with the type
920specified by @var{record-name}.
921@end deffn
922
923@deffn {Scheme Syntax} record-constructor-descriptor record-name
924Evaluates to the record-constructor descriptor associated with the type
925specified by @var{record-name}.
926@end deffn
927
928@node rnrs records procedural
929@subsubsection rnrs records procedural
930
931The @code{(rnrs records procedural (6))} library exports the procedural
932API for working with R6RS records.
933
934@deffn {Scheme Procedure} make-record-type-descriptor name parent uid sealed? opaque? fields
935Returns a new record-type descriptor with the specified characteristics:
936@var{name} must be a symbol giving the name of the new record type;
937@var{parent} must be either @code{#f} or a non-sealed record-type
938descriptor for the returned record type to extend; @var{uid} must be
939either @code{#f}, indicating that the record type is generative, or
940a symbol giving the type's nongenerative uid; @var{sealed?} and
941@var{opaque?} must be boolean values that specify the sealedness and
942opaqueness of the record type; @var{fields} must be a vector of zero or
943more field specifiers of the form @code{(mutable name)} or
944@code{(immutable name)}, where name is a symbol giving a name for the
945field.
946
947If @var{uid} is not @code{#f}, it must be a symbol
948@end deffn
949
950@deffn {Scheme Procedure} record-type-descriptor? obj
951Returns @code{#t} if @var{obj} is a record-type descriptor, @code{#f}
952otherwise.
953@end deffn
954
955@deffn {Scheme Procedure} make-record-constructor-descriptor rtd parent-constructor-descriptor protocol
956Returns a new record constructor descriptor that can be used to produce
957constructors for the record type specified by the record-type descriptor
958@var{rtd} and whose delegation and binding behavior are specified by the
959protocol procedure @var{protocol}.
960
961@var{parent-constructor-descriptor} specifies a record constructor
962descriptor for the parent type of @var{rtd}, if one exists. If
963@var{rtd} represents a base type, then
964@var{parent-constructor-descriptor} must be @code{#f}. If @var{rtd}
965is an extension of another type, @var{parent-constructor-descriptor} may
966still be @code{#f}, but protocol must also be @code{#f} in this case.
967@end deffn
968
969@deffn {Scheme Procedure} record-constructor rcd
970Returns a record constructor procedure by invoking the protocol
971defined by the record-constructor descriptor @var{rcd}.
972@end deffn
973
974@deffn {Scheme Procedure} record-predicate rtd
975Returns the record predicate procedure for the record-type descriptor
976@var{rtd}.
977@end deffn
978
979@deffn {Scheme Procedure} record-accessor rtd k
980Returns the record field accessor procedure for the @var{k}th field of
981the record-type descriptor @var{rtd}.
982@end deffn
983
984@deffn {Scheme Procedure} record-mutator rtd k
985Returns the record field mutator procedure for the @var{k}th field of
986the record-type descriptor @var{rtd}. An @code{&assertion} condition
987will be raised if this field is not mutable.
988@end deffn
989
990@node rnrs records inspection
991@subsubsection rnrs records inspection
992
993The @code{(rnrs records inspection (6))} library provides procedures
994useful for accessing metadata about R6RS records.
995
996@deffn {Scheme Procedure} record? obj
997Return @code{#t} if the specified object is a non-opaque R6RS record,
998@code{#f} otherwise.
999@end deffn
1000
1001@deffn {Scheme Procedure} record-rtd record
1002Returns the record-type descriptor for @var{record}. An
1003@code{&assertion} is raised if @var{record} is opaque.
1004@end deffn
1005
1006@deffn {Scheme Procedure} record-type-name rtd
1007Returns the name of the record-type descriptor @var{rtd}.
1008@end deffn
1009
1010@deffn {Scheme Procedure} record-type-parent rtd
1011Returns the parent of the record-type descriptor @var{rtd}, or @code{#f}
1012if it has none.
1013@end deffn
1014
1015@deffn {Scheme Procedure} record-type-uid rtd
1016Returns the uid of the record-type descriptor @var{rtd}, or @code{#f} if
1017it has none.
1018@end deffn
1019
1020@deffn {Scheme Procedure} record-type-generative? rtd
1021Returns @code{#t} if the record-type descriptor @var{rtd} is generative,
1022@code{#f} otherwise.
1023@end deffn
1024
1025@deffn {Scheme Procedure} record-type-sealed? rtd
1026Returns @code{#t} if the record-type descriptor @var{rtd} is sealed,
1027@code{#f} otherwise.
1028@end deffn
1029
1030@deffn {Scheme Procedure} record-type-opaque? rtd
1031Returns @code{#t} if the record-type descriptor @var{rtd} is opaque,
1032@code{#f} otherwise.
1033@end deffn
1034
1035@deffn {Scheme Procedure} record-type-field-names rtd
1036Returns a vector of symbols giving the names of the fields defined by
1037the record-type descriptor @var{rtd} (and not any of its sub- or
1038supertypes).
1039@end deffn
1040
1041@deffn {Scheme Procedure} record-field-mutable? rtd k
1042Returns @code{#t} if the field at index @var{k} of the record-type
1043descriptor @var{rtd} (and not any of its sub- or supertypes) is mutable.
1044@end deffn
1045
1046@node rnrs exceptions
1047@subsubsection rnrs exceptions
1048
1049The @code{(rnrs exceptions (6))} library provides functionality related
1050to signaling and handling exceptional situations. This functionality is
1051similar to the exception handling systems provided by Guile's core
5b379729
JG
1052library @xref{Exceptions}, and by the SRFI-18 and SRFI-34
1053modules---@xref{SRFI-18 Exceptions}, and @ref{SRFI-34},
1054respectively---but there are some key differences in concepts and
ea28e981
JG
1055behavior.
1056
1057A raised exception may be @dfn{continuable} or @dfn{non-continuable}.
1058When an exception is raised non-continuably, another exception, with the
1059condition type @code{&non-continuable}, will be raised when the
1060exception handler returns locally. Raising an exception continuably
1061captures the current continuation and invokes it after a local return
1062from the exception handler.
1063
1064Like SRFI-18 and SRFI-34, R6RS exceptions are implemented on top of
1065Guile's native @code{throw} and @code{catch} forms, and use custom
1066``throw keys'' to identify their exception types. As a consequence,
1067Guile's @code{catch} form can handle exceptions thrown by these APIs,
1068but the reverse is not true: Handlers registered by the
1069@code{with-exception-handler} procedure described below will only be
1070called on exceptions thrown by the corresponding @code{raise} procedure.
1071
1072@deffn {Scheme Procedure} with-exception-handler handler thunk
1073Installs @var{handler}, which must be a procedure taking one argument,
1074as the current exception handler during the invokation of @var{thunk}, a
1075procedure taking zero arguments. The handler in place at the time
1076@code{with-exception-handler} is called is made current again once
1077either @var{thunk} returns or @var{handler} is invoked after an
1078exception is thrown from within @var{thunk}.
1079
1080This procedure is similar to the @code{with-throw-handler} procedure
1081provided by Guile's code library; (@pxref{Throw Handlers}).
1082@end deffn
1083
1084@deffn {Scheme Syntax} guard (variable clause1 clause2 ...) body
1085Evaluates the expression given by @var{body}, first creating an ad hoc
1086exception handler that binds a raised exception to @var{variable} and
1087then evaluates the specified @var{clause}s as if they were part of a
5b379729
JG
1088@code{cond} expression, with the value of the first matching clause
1089becoming the value of the @code{guard} expression
1090(@pxref{if cond case}). If none of the clause's test expressions
1091evaluates to @code{#t}, the exception is re-raised, with the exception
1092handler that was current before the evaluation of the @code{guard} form.
ea28e981
JG
1093
1094For example, the expression
1095
1096@lisp
1097(guard (ex ((eq? ex 'foo) 'bar) ((eq? ex 'bar) 'baz))
1098 (raise 'bar))
1099@end lisp
1100
1101evaluates to @code{baz}.
1102@end deffn
1103
1104@deffn {Scheme Procedure} raise obj
1105Raises a non-continuable exception by invoking the currently-installed
1106exception handler on @var{obj}. If the handler returns, a
1107@code{&non-continuable} exception will be raised in the dynamic context
1108in which the handler was installed.
1109@end deffn
1110
1111@deffn {Scheme Procedure} raise-continuable obj
1112Raises a continuable exception by invoking currently-installed exception
1113handler on @var{obj}.
1114@end deffn
1115
1116@node rnrs conditions
1117@subsubsection rnrs conditions
1118
1119The @code{(rnrs condition (6))} library provides forms and procedures
1120for constructing new condition types, as well as a library of
1121pre-defined condition types that represent a variety of common
1122exceptional situations. Conditions are records of a subtype of the
1123@code{&condition} record type, which is neither sealed nor opaque.
1124@xref{R6RS Records}.
1125
1126Conditions may be manipulated singly, as @dfn{simple conditions}, or
1127when composed with other conditions to form @dfn{compound conditions}.
5b379729 1128Compound conditions do not ``nest''---constructing a new compound
ea28e981
JG
1129condition out of existing compound conditions will ``flatten'' them
1130into their component simple conditions. For example, making a new
1131condition out of a @code{&message} condition and a compound condition
1132that contains an @code{&assertion} condition and another @code{&message}
1133condition will produce a compound condition that contains two
1134@code{&message} conditions and one @code{&assertion} condition.
1135
1136The record type predicates and field accessors described below can
1137operate on either simple or compound conditions. In the latter case,
1138the predicate returns @code{#t} if the compound condition contains a
1139component simple condition of the appropriate type; the field accessors
1140return the requisite fields from the first component simple condition
1141found to be of the appropriate type.
1142
5b379729
JG
1143This library is quite similar to the SRFI-35 conditions module
1144(@pxref{SRFI-35}). Among other minor differences, the
1145@code{(rnrs conditions)} library features slightly different semantics
1146around condition field accessors, and comes with a larger number of
1147pre-defined condition types. The two APIs are not currently compatible,
1148however; the @code{condition?} predicate from one API will return
1149@code{#f} when applied to a condition object created in the other.
1150
2604f1ad
NJ
1151@deffn {Condition Type} &condition
1152@deffnx {Scheme Procedure} condition? obj
ea28e981
JG
1153The base record type for conditions.
1154@end deffn
1155
1156@deffn {Scheme Procedure} condition condition1 ...
1157@deffnx {Scheme Procedure} simple-conditions condition
1158The @code{condition} procedure creates a new compound condition out of
1159its condition arguments, flattening any specified compound conditions
1160into their component simple conditions as described above.
1161
1162@code{simple-conditions} returns a list of the component simple
1163conditions of the compound condition @code{condition}, in the order in
1164which they were specified at construction time.
1165@end deffn
1166
1167@deffn {Scheme Procedure} condition-predicate rtd
1168@deffnx {Scheme Procedure} condition-accessor rtd proc
1169These procedures return condition predicate and accessor procedures for
1170the specified condition record type @var{rtd}.
1171@end deffn
1172
1173@deffn {Scheme Syntax} define-condition-type condition-type supertype constructor predicate field-spec ...
1174Evaluates to a new record type definition for a condition type with the
1175name @var{condition-type} that has the condition type @var{supertype} as
1176its parent. A default constructor, which binds its arguments to the
1177fields of this type and its parent types, will be bound to the
1178identifier @var{constructor}; a condition predicate will be bound to
1179@var{predicate}. The fields of the new type, which are immutable, are
1180specified by the @var{field-spec}s, each of which must be of the form:
1181@lisp
1182(field accessor)
1183@end lisp
1184where @var{field} gives the name of the field and @var{accessor} gives
1185the name for a binding to an accessor procedure created for this field.
1186@end deffn
1187
2604f1ad 1188@deffn {Condition Type} &message
ea28e981
JG
1189@deffnx {Scheme Procedure} make-message-condition message
1190@deffnx {Scheme Procedure} message-condition? obj
1191@deffnx {Scheme Procedure} condition-message condition
1192A type that includes a message describing the condition that occurred.
1193@end deffn
1194
2604f1ad 1195@deffn {Condition Type} &warning
ea28e981
JG
1196@deffnx {Scheme Procedure} make-warning
1197@deffnx {Scheme Procedure} warning? obj
1198A base type for representing non-fatal conditions during execution.
1199@end deffn
1200
2604f1ad 1201@deffn {Condition Type} &serious
ea28e981
JG
1202@deffnx {Scheme Procedure} make-serious-condition
1203@deffnx {Scheme Procedure} serious-condition? obj
1204A base type for conditions representing errors serious enough that
1205cannot be ignored.
1206@end deffn
1207
2604f1ad 1208@deffn {Condition Type} &error
ea28e981
JG
1209@deffnx {Scheme Procedure} make-error
1210@deffnx {Scheme Procedure} error? obj
1211A base type for conditions representing errors.
1212@end deffn
1213
2604f1ad 1214@deffn {Condition Type} &violation
ea28e981
JG
1215@deffnx {Scheme Procedure} make-violation
1216@deffnx {Scheme Procedure} violation?
1217A subtype of @code{&serious} that can be used to represent violations
1218of a language or library standard.
1219@end deffn
1220
2604f1ad 1221@deffn {Condition Type} &assertion
ea28e981
JG
1222@deffnx {Scheme Procedure} make-assertion-violation
1223@deffnx {Scheme Procedure} assertion-violation? obj
1224A subtype of @code{&violation} that indicates an invalid call to a
1225procedure.
1226@end deffn
1227
2604f1ad 1228@deffn {Condition Type} &irritants
ea28e981
JG
1229@deffnx {Scheme Procedure} make-irritants-condition irritants
1230@deffnx {Scheme Procedure} irritants-condition? obj
1231@deffnx {Scheme Procedure} condition-irritants condition
1232A base type used for storing information about the causes of another
1233condition in a compound condition.
1234@end deffn
1235
2604f1ad 1236@deffn {Condition Type} &who
ea28e981
JG
1237@deffnx {Scheme Procedure} make-who-condition who
1238@deffnx {Scheme Procedure} who-condition? obj
1239@deffnx {Scheme Procedure} condiction-who condition
1240A base type used for storing the identity, a string or symbol, of the
1241entity responsible for another condition in a compound condition.
1242@end deffn
1243
2604f1ad 1244@deffn {Condition Type} &non-continuable
ea28e981
JG
1245@deffnx {Scheme Procedure} make-non-continuable-violation
1246@deffnx {Scheme Procedure} non-continuable-violation? obj
1247A subtype of @code{&violation} used to indicate that an exception
1248handler invoked by @code{raise} has returned locally.
1249@end deffn
1250
2604f1ad 1251@deffn {Condition Type} &implementation-restriction
ea28e981
JG
1252@deffnx {Scheme Procedure} make-implementation-restriction-violation
1253@deffnx {Scheme Procedure} implementation-restriction-violation? obj
1254A subtype of @code{&violation} used to indicate a violation of an
1255implementation restriction.
1256@end deffn
1257
2604f1ad 1258@deffn {Condition Type} &lexical
ea28e981
JG
1259@deffnx {Scheme Procedure} make-lexical-violation
1260@deffnx {Scheme Procedure} lexical-violation? obj
1261A subtype of @code{&violation} used to indicate a syntax violation at
1262the level of the datum syntax.
1263@end deffn
1264
2604f1ad 1265@deffn {Condition Type} &syntax
ea28e981
JG
1266@deffnx {Scheme Procedure} make-syntax-violation form subform
1267@deffnx {Scheme Procedure} syntax-violation? obj
1268@deffnx {Scheme Procedure} syntax-violation-form condition
1269@deffnx {Scheme Procedure} syntax-violation-subform condition
1270A subtype of @code{&violation} that indicates a syntax violation. The
1271@var{form} and @var{subform} fields, which must be datum values,
1272indicate the syntactic form responsible for the condition.
1273@end deffn
1274
2604f1ad 1275@deffn {Condition Type} &undefined
ea28e981
JG
1276@deffnx {Scheme Procedure} make-undefined-violation
1277@deffnx {Scheme Procedure} undefined-violation? obj
1278A subtype of @code{&violation} that indicates a reference to an unbound
1279identifier.
1280@end deffn
1281
1282@node I/O Conditions
1283@subsubsection I/O Conditions
1284
1285These condition types are exported by both the
1286@code{(rnrs io ports (6))} and @code{(rnrs io simple (6))} libraries.
1287
2604f1ad 1288@deffn {Condition Type} &i/o
ea28e981
JG
1289@deffnx {Scheme Procedure} make-i/o-error
1290@deffnx {Scheme Procedure} i/o-error? obj
1291A condition supertype for more specific I/O errors.
1292@end deffn
1293
2604f1ad 1294@deffn {Condition Type} &i/o-read
ea28e981
JG
1295@deffnx {Scheme Procedure} make-i/o-read-error
1296@deffnx {Scheme Procedure} i/o-read-error? obj
1297A subtype of @code{&i/o}; represents read-related I/O errors.
1298@end deffn
1299
2604f1ad 1300@deffn {Condition Type} &i/o-write
ea28e981
JG
1301@deffnx {Scheme Procedure} make-i/o-write-error
1302@deffnx {Scheme Procedure} i/o-write-error? obj
1303A subtype of @code{&i/o}; represents write-related I/O errors.
1304@end deffn
1305
2604f1ad 1306@deffn {Condition Type} &i/o-invalid-position
ea28e981
JG
1307@deffnx {Scheme Procedure} make-i/o-invalid-position-error position
1308@deffnx {Scheme Procedure} i/o-invalid-position-error? obj
1309@deffnx {Scheme Procedure} i/o-error-position condition
1310A subtype of @code{&i/o}; represents an error related to an attempt to
1311set the file position to an invalid position.
1312@end deffn
1313
2604f1ad 1314@deffn {Condition Type} &i/o-filename
ea28e981
JG
1315@deffnx {Scheme Procedure} make-io-filename-error filename
1316@deffnx {Scheme Procedure} i/o-filename-error? obj
1317@deffnx {Scheme Procedure} i/o-error-filename condition
1318A subtype of @code{&i/o}; represents an error related to an operation on
1319a named file.
1320@end deffn
1321
2604f1ad 1322@deffn {Condition Type} &i/o-file-protection
ea28e981
JG
1323@deffnx {Scheme Procedure} make-i/o-file-protection-error filename
1324@deffnx {Scheme Procedure} i/o-file-protection-error? obj
1325A subtype of @code{&i/o-filename}; represents an error resulting from an
1326attempt to access a named file for which the caller had insufficient
1327permissions.
1328@end deffn
1329
2604f1ad 1330@deffn {Condition Type} &i/o-file-is-read-only
ea28e981
JG
1331@deffnx {Scheme Procedure} make-i/o-file-is-read-only-error filename
1332@deffnx {Scheme Procedure} i/o-file-is-read-only-error? obj
1333A subtype of @code{&i/o-file-protection}; represents an error related to
1334an attempt to write to a read-only file.
1335@end deffn
1336
2604f1ad 1337@deffn {Condition Type} &i/o-file-already-exists
ea28e981
JG
1338@deffnx {Scheme Procedure} make-i/o-file-already-exists-error filename
1339@deffnx {Scheme Procedure} i/o-file-already-exists-error? obj
1340A subtype of @code{&i/o-filename}; represents an error related to an
1341operation on an existing file that was assumed not to exist.
1342@end deffn
1343
2604f1ad 1344@deffn {Condition Type} &i/o-file-does-not-exist
ea28e981
JG
1345@deffnx {Scheme Procedure} make-i/o-file-does-not-exist-error
1346@deffnx {Scheme Procedure} i/o-file-does-not-exist-error? obj
1347A subtype of @code{&i/o-filename}; represents an error related to an
1348operation on a non-existent file that was assumed to exist.
1349@end deffn
1350
2604f1ad 1351@deffn {Condition Type} &i/o-port
ea28e981
JG
1352@deffnx {Scheme Procedure} make-i/o-port-error port
1353@deffnx {Scheme Procedure} i/o-port-error? obj
1354@deffnx {Scheme Procedure} i/o-error-port condition
1355A subtype of @code{&i/o}; represents an error related to an operation on
1356the port @var{port}.
1357@end deffn
1358
1359@node rnrs io ports
1360@subsubsection rnrs io ports
1361
1362The @code{(rnrs io ports (6))} library provides various procedures and
1363syntactic forms for use in writing to and reading from ports. This
1364functionality is documented in its own section of the manual;
1365(@pxref{R6RS I/O Ports}).
1366
1367@node rnrs io simple
1368@subsubsection rnrs io simple
1369
1370The @code{(rnrs io simple (6))} library provides convenience functions
1371for performing textual I/O on ports. This library also exports all of
1372the condition types and associated procedures described in
1373(@pxref{I/O Conditions}).
1374
1375@deffn {Scheme Procedure} eof-object
1376@deffnx {Scheme Procedure} eof-object? obj
1377These procedures are identical to the ones provided by the
1378@code{(rnrs io ports (6))} library. @xref{R6RS I/O Ports}, for
1379documentation.
1380@end deffn
1381
1382@deffn {Scheme Procedure} input-port? obj
1383@deffnx {Scheme Procedure} output-port? obj
1384These procedures are identical to the ones provided by Guile's core
1385library. @xref{Ports}, for documentation.
1386@end deffn
1387
1388@deffn {Scheme Procedure} call-with-input-file filename proc
1389@deffnx {Scheme Procedure} call-with-output-file filename proc
1390@deffnx {Scheme Procedure} open-input-file filename
1391@deffnx {Scheme Procedure} open-output-file filename
1392@deffnx {Scheme Procedure} with-input-from-file filename thunk
1393@deffnx {Scheme Procedure} with-output-to-file filename thunk
1394These procedures are identical to the ones provided by Guile's core
1395library. @xref{File Ports}, for documentation.
1396@end deffn
1397
1398@deffn {Scheme Procedure} close-input-port input-port
1399@deffnx {Scheme Procedure} close-output-port output-port
1400These procedures are identical to the ones provided by Guile's core
1401library. @xref{Closing}, for documentation.
1402@end deffn
1403
1404@deffn {Scheme Procedure} peek-char
1405@deffnx {Scheme Procedure} peek-char textual-input-port
1406@deffnx {Scheme Procedure} read-char
1407@deffnx {Scheme Procedure} read-char textual-input-port
1408These procedures are identical to the ones provided by Guile's core
1409library. @xref{Reading}, for documentation.
1410@end deffn
1411
1412@deffn {Scheme Procedure} read
1413@deffnx {Scheme Procedure} read textual-input-port
1414This procedure is identical to the one provided by Guile's core library.
1415@xref{Scheme Read}, for documentation.
1416@end deffn
1417
1418@deffn {Scheme Procedure} display obj
1419@deffnx {Scheme Procedure} display obj textual-output-port
1420@deffnx {Scheme Procedure} newline
1421@deffnx {Scheme Procedure} newline textual-output-port
1422@deffnx {Scheme Procedure} write obj
1423@deffnx {Scheme Procedure} write obj textual-output-port
1424@deffnx {Scheme Procedure} write-char char
1425@deffnx {Scheme Procedure} write-char char textual-output-port
1426These procedures are identical to the ones provided by Guile's core
1427library. @xref{Writing}, for documentation.
1428@end deffn
1429
1430@node rnrs files
1431@subsubsection rnrs files
1432
1433The @code{(rnrs files (6))} library provides the @code{file-exists?} and
1434@code{delete-file} procedures, which test for the existence of a file
1435and allow the deletion of files from the filesystem, respectively.
1436
1437These procedures are identical to the ones provided by Guile's core
1438library. @xref{File System}, for documentation.
1439
1440@node rnrs programs
1441@subsubsection rnrs programs
1442
1443The @code{(rnrs programs (6))} library provides procedures for
1444process management and introspection.
1445
1446@deffn {Scheme Procedure} command-line
1447This procedure is identical to the one provided by Guile's core library.
1448@xref{Runtime Environment}, for documentation.
1449@end deffn
1450
1451@deffn {Scheme Procedure} exit
1452@deffnx {Scheme Procedure} exit obj
1453This procedure is identical to the one provided by Guile's core library.
1454@end deffn
1455
1456@node rnrs arithmetic fixnums
1457@subsubsection rnrs arithmetic fixnums
1458
1459The @code{(rnrs arithmetic fixnums (6))} library provides procedures for
1460performing arithmetic operations on an implementation-dependent range of
1461exact integer values, which R6RS refers to as @dfn{fixnums}. In Guile,
1462the size of a fixnum is determined by the size of the @code{SCM} type; a
1463single SCM struct is guaranteed to be able to hold an entire fixnum,
5b379729
JG
1464making fixnum computations particularly
1465efficient---(@pxref{The SCM Type}). On 32-bit systems, the most
1466negative and most positive fixnum values are, respectively, -536870912
1467and 536870911.
ea28e981
JG
1468
1469Unless otherwise specified, all of the procedures below take fixnums as
1470arguments, and will raise an @code{&assertion} condition if passed a
1471non-fixnum argument or an @code{&implementation-restriction} condition
1472if their result is not itself a fixnum.
1473
1474@deffn {Scheme Procedure} fixnum? obj
1475Returns @code{#t} if @var{obj} is a fixnum, @code{#f} otherwise.
1476@end deffn
1477
1478@deffn {Scheme Procedure} fixnum-width
1479@deffnx {Scheme Procedure} least-fixnum
1480@deffnx {Scheme Procedure} greatest-fixnum
1481These procedures return, respectively, the maximum number of bits
1482necessary to represent a fixnum value in Guile, the minimum fixnum
1483value, and the maximum fixnum value.
1484@end deffn
1485
1486@deffn {Scheme Procedure} fx=? fx1 fx2 fx3 ...
1487@deffnx {Scheme Procedure} fx>? fx1 fx2 fx3 ...
1488@deffnx {Scheme Procedure} fx<? fx1 fx2 fx3 ...
1489@deffnx {Scheme Procedure} fx>=? fx1 fx2 fx3 ...
1490@deffnx {Scheme Procedure} fx<=? fx1 fx2 fx3 ...
1491These procedures return @code{#t} if their fixnum arguments are
1492(respectively): equal, monotonically increasing, monotonically
1493decreasing, monotonically nondecreasing, or monotonically nonincrasing;
1494@code{#f} otherwise.
1495@end deffn
1496
1497@deffn {Scheme Procedure} fxzero? fx
1498@deffnx {Scheme Procedure} fxpositive? fx
1499@deffnx {Scheme Procedure} fxnegative? fx
1500@deffnx {Scheme Procedure} fxodd? fx
1501@deffnx {Scheme Procedure} fxeven? fx
1502These numerical predicates return @code{#t} if @var{fx} is,
1503respectively, zero, greater than zero, less than zero, odd, or even;
1504@code{#f} otherwise.
1505@end deffn
1506
1507@deffn {Scheme Procedure} fxmax fx1 fx2 ...
1508@deffnx {Scheme Procedure} fxmin fx1 fx2 ...
1509These procedures return the maximum or minimum of their arguments.
1510@end deffn
1511
1512@deffn {Scheme Procedure} fx+ fx1 fx2
1513@deffnx {Scheme Procedure} fx* fx1 fx2
1514These procedures return the sum or product of their arguments.
1515@end deffn
1516
1517@deffn {Scheme Procedure} fx- fx1 fx2
1518@deffnx {Scheme Procedure} fx- fx
1519Returns the difference of @var{fx1} and @var{fx2}, or the negation of
1520@var{fx}, if called with a single argument.
1521
1522An @code{&assertion} condition is raised if the result is not itself a
1523fixnum.
1524@end deffn
1525
1526@deffn {Scheme Procedure} fxdiv-and-mod fx1 fx2
1527@deffnx {Scheme Procedure} fxdiv fx1 fx2
1528@deffnx {Scheme Procedure} fxmod fx1 fx2
1529@deffnx {Scheme Procedure} fxdiv0-and-mod0 fx1 fx2
1530@deffnx {Scheme Procedure} fxdiv0 fx1 fx2
1531@deffnx {Scheme Procedure} fxmod0 fx1 fx2
1532These procedures implement number-theoretic division on fixnums;
5b379729 1533@xref{(rnrs base)}, for a description of their semantics.
ea28e981
JG
1534@end deffn
1535
1536@deffn {Scheme Procedure} fx+/carry fx1 fx2 fx3
1537Returns the two fixnum results of the following computation:
1538@lisp
1539(let* ((s (+ fx1 fx2 fx3))
1540 (s0 (mod0 s (expt 2 (fixnum-width))))
1541 (s1 (div0 s (expt 2 (fixnum-width)))))
1542 (values s0 s1))
1543@end lisp
1544@end deffn
1545
1546@deffn {Scheme Procedure} fx-/carry fx1 fx2 fx3
1547Returns the two fixnum results of the following computation:
1548@lisp
1549(let* ((d (- fx1 fx2 fx3))
1550 (d0 (mod0 d (expt 2 (fixnum-width))))
1551 (d1 (div0 d (expt 2 (fixnum-width)))))
1552 (values d0 d1))
1553@end lisp
1554@end deffn
1555
1556@deffn {Scheme Procedure} fx*/carry fx1 fx2 fx3
1557@lisp
1558Returns the two fixnum results of the following computation:
1559(let* ((s (+ (* fx1 fx2) fx3))
1560 (s0 (mod0 s (expt 2 (fixnum-width))))
1561 (s1 (div0 s (expt 2 (fixnum-width)))))
1562 (values s0 s1))
1563@end lisp
1564@end deffn
1565
1566@deffn {Scheme Procedure} fxnot fx
1567@deffnx {Scheme Procedure} fxand fx1 ...
1568@deffnx {Scheme Procedure} fxior fx1 ...
1569@deffnx {Scheme Procedure} fxxor fx1 ...
1570These procedures are identical to the @code{lognot}, @code{logand},
1571@code{logior}, and @code{logxor} procedures provided by Guile's core
1572library. @xref{Bitwise Operations}, for documentation.
1573@end deffn
1574
1575@deffn {Scheme Procedure} fxif fx1 fx2 fx3
1576Returns the bitwise ``if'' of its fixnum arguments. The bit at position
1577@code{i} in the return value will be the @code{i}th bit from @var{fx2}
1578if the @code{i}th bit of @var{fx1} is 1, the @code{i}th bit from
1579@var{fx3}.
1580@end deffn
1581
1582@deffn {Scheme Procedure} fxbit-count fx
1583Returns the number of 1 bits in the two's complement representation of
1584@var{fx}.
1585@end deffn
1586
1587@deffn {Scheme Procedure} fxlength fx
1588Returns the number of bits necessary to represent @var{fx}.
1589@end deffn
1590
1591@deffn {Scheme Procedure} fxfirst-bit-set fx
1592Returns the index of the least significant 1 bit in the two's complement
1593representation of @var{fx}.
1594@end deffn
1595
1596@deffn {Scheme Procedure} fxbit-set? fx1 fx2
1597Returns @code{#t} if the @var{fx2}th bit in the two's complement
1598representation of @var{fx1} is 1, @code{#f} otherwise.
1599@end deffn
1600
1601@deffn {Scheme Procedure} fxcopy-bit fx1 fx2 fx3
1602Returns the result of setting the @var{fx2}th bit of @var{fx1} to the
1603@var{fx2}th bit of @var{fx3}.
1604@end deffn
1605
1606@deffn {Scheme Procedure} fxbit-field fx1 fx2 fx3
1607Returns the integer representation of the contiguous sequence of bits in
1608@var{fx1} that starts at position @var{fx2} (inclusive) and ends at
1609position @var{fx3} (exclusive).
1610@end deffn
1611
1612@deffn {Scheme Procedure} fxcopy-bit-field fx1 fx2 fx3 fx4
1613Returns the result of replacing the bit field in @var{fx1} with start
1614and end positions @var{fx2} and @var{fx3} with the corresponding bit
1615field from @var{fx4}.
1616@end deffn
1617
1618@deffn {Scheme Procedure} fxarithmetic-shift fx1 fx2
1619@deffnx {Scheme Procedure} fxarithmetic-shift-left fx1 fx2
1620@deffnx {Scheme Procedure} fxarithmetic-shift-right fx1 fx2
1621Returns the result of shifting the bits of @var{fx1} right or left by
1622the @var{fx2} positions. @code{fxarithmetic-shift} is identical
1623to @code{fxarithmetic-shift-left}.
1624@end deffn
1625
1626@deffn {Scheme Procedure} fxrotate-bit-field fx1 fx2 fx3 fx4
1627Returns the result of cyclically permuting the bit field in @var{fx1}
1628with start and end positions @var{fx2} and @var{fx3} by @var{fx4} bits
1629in the direction of more significant bits.
1630@end deffn
1631
1632@deffn {Scheme Procedure} fxreverse-bit-field fx1 fx2 fx3
1633Returns the result of reversing the order of the bits of @var{fx1}
1634between position @var{fx2} (inclusive) and position @var{fx3}
1635(exclusive).
1636@end deffn
1637
1638@node rnrs arithmetic flonums
1639@subsubsection rnrs arithmetic flonums
1640
1641The @code{(rnrs arithmetic flonums (6))} library provides procedures for
1642performing arithmetic operations on inexact representations of real
1643numbers, which R6RS refers to as @dfn{flonums}.
1644
1645Unless otherwise specified, all of the procedures below take flonums as
1646arguments, and will raise an @code{&assertion} condition if passed a
1647non-flonum argument.
1648
1649@deffn {Scheme Procedure} flonum? obj
1650Returns @code{#t} if @var{obj} is a flonum, @code{#f} otherwise.
1651@end deffn
1652
1653@deffn {Scheme Procedure} real->flonum x
1654Returns the flonum that is numerically closest to the real number
1655@var{x}.
1656@end deffn
1657
1658@deffn {Scheme Procedure} fl=? fl1 fl2 fl3 ...
1659@deffnx {Scheme Procedure} fl<? fl1 fl2 fl3 ...
1660@deffnx {Scheme Procedure} fl<=? fl1 fl2 fl3 ...
1661@deffnx {Scheme Procedure} fl>? fl1 fl2 fl3 ...
1662@deffnx {Scheme Procedure} fl>=? fl1 fl2 fl3 ...
1663These procedures return @code{#t} if their flonum arguments are
1664(respectively): equal, monotonically increasing, monotonically
1665decreasing, monotonically nondecreasing, or monotonically nonincrasing;
1666@code{#f} otherwise.
1667@end deffn
1668
1669@deffn {Scheme Procedure} flinteger? fl
1670@deffnx {Scheme Procedure} flzero? fl
1671@deffnx {Scheme Procedure} flpositive? fl
1672@deffnx {Scheme Procedure} flnegative? fl
1673@deffnx {Scheme Procedure} flodd? fl
1674@deffnx {Scheme Procedure} fleven? fl
1675These numerical predicates return @code{#t} if @var{fl} is,
1676respectively, an integer, zero, greater than zero, less than zero, odd,
1677even, @code{#f} otherwise. In the case of @code{flodd?} and
1678@code{fleven?}, @var{fl} must be an integer-valued flonum.
1679@end deffn
1680
1681@deffn {Scheme Procedure} flfinite? fl
1682@deffnx {Scheme Procedure} flinfinite? fl
1683@deffnx {Scheme Procedure} flnan? fl
1684These numerical predicates return @code{#t} if @var{fl} is,
1685respectively, not infinite, infinite, or a @code{NaN} value.
1686@end deffn
1687
1688@deffn {Scheme Procedure} flmax fl1 fl2 ...
1689@deffnx {Scheme Procedure} flmin fl1 fl2 ...
1690These procedures return the maximum or minimum of their arguments.
1691@end deffn
1692
1693@deffn {Scheme Procedure} fl+ fl1 ...
1694@deffnx {Scheme Procedure} fl* fl ...
1695These procedures return the sum or product of their arguments.
1696@end deffn
1697
1698@deffn {Scheme Procedure} fl- fl1 fl2 ...
1699@deffnx {Scheme Procedure} fl- fl
1700@deffnx {Scheme Procedure} fl/ fl1 fl2 ...
1701@deffnx {Scheme Procedure} fl/ fl
1702These procedures return, respectively, the difference or quotient of
1703their arguments when called with two arguments; when called with a
1704single argument, they return the additive or multiplicative inverse of
1705@var{fl}.
1706@end deffn
1707
1708@deffn {Scheme Procedure} flabs fl
1709Returns the absolute value of @var{fl}.
1710@end deffn
1711
1712@deffn {Scheme Procedure} fldiv-and-mod fl1 fl2
1713@deffnx {Scheme Procedure} fldiv fl1 fl2
1714@deffnx {Scheme Procedure} fldmod fl1 fl2
1715@deffnx {Scheme Procedure} fldiv0-and-mod0 fl1 fl2
1716@deffnx {Scheme Procedure} fldiv0 fl1 fl2
1717@deffnx {Scheme Procedure} flmod0 fl1 fl2
1718These procedures implement number-theoretic division on flonums;
5b379729 1719@xref{(rnrs base)}, for a description for their semantics.
ea28e981
JG
1720@end deffn
1721
1722@deffn {Scheme Procedure} flnumerator fl
1723@deffnx {Scheme Procedure} fldenominator fl
1724These procedures return the numerator or denominator of @var{fl} as a
1725flonum.
1726@end deffn
1727
1728@deffn {Scheme Procedure} flfloor fl1
1729@deffnx {Scheme Procedure} flceiling fl
1730@deffnx {Scheme Procedure} fltruncate fl
1731@deffnx {Scheme Procedure} flround fl
1732These procedures are identical to the @code{floor}, @code{ceiling},
1733@code{truncate}, and @code{round} procedures provided by Guile's core
1734library. @xref{Arithmetic}, for documentation.
1735@end deffn
1736
1737@deffn {Scheme Procedure} flexp fl
1738@deffnx {Scheme Procedure} fllog fl
1739@deffnx {Scheme Procedure} fllog fl1 fl2
1740@deffnx {Scheme Procedure} flsin fl
1741@deffnx {Scheme Procedure} flcos fl
1742@deffnx {Scheme Procedure} fltan fl
1743@deffnx {Scheme Procedure} flasin fl
1744@deffnx {Scheme Procedure} flacos fl
1745@deffnx {Scheme Procedure} flatan fl
1746@deffnx {Scheme Procedure} flatan fl1 fl2
1747These procedures, which compute the usual transcendental functions, are
1748the flonum variants of the procedures provided by the R6RS base library
1749(@pxref{(rnrs base)}).
1750@end deffn
1751
1752@deffn {Scheme Procedure} flsqrt fl
1753Returns the square root of @var{fl}. If @var{fl} is @code{-0.0},
1754@var{-0.0} is returned; for other negative values, a @code{NaN} value
1755is returned.
1756@end deffn
1757
1758@deffn {Scheme Procedure} flexpt fl1 fl2
1759Returns the value of @var{fl1} raised to the power of @var{fl2}.
1760@end deffn
1761
1762The following condition types are provided to allow Scheme
1763implementations that do not support infinities or @code{NaN} values
1764to indicate that a computation resulted in such a value. Guile supports
1765both of these, so these conditions will never be raised by Guile's
1766standard libraries implementation.
1767
2604f1ad 1768@deffn {Condition Type} &no-infinities
ea28e981
JG
1769@deffnx {Scheme Procedure} make-no-infinities-violation obj
1770@deffnx {Scheme Procedure} no-infinities-violation?
1771A condition type indicating that a computation resulted in an infinite
1772value on a Scheme implementation incapable of representing infinities.
1773@end deffn
1774
2604f1ad 1775@deffn {Condition Type} &no-nans
ea28e981
JG
1776@deffnx {Scheme Procedure} make-no-nans-violation obj
1777@deffnx {Scheme Procedure} no-nans-violation? obj
1778A condition type indicating that a computation resulted in a @code{NaN}
1779value on a Scheme implementation incapable of representing @code{NaN}s.
1780@end deffn
1781
1782@deffn {Scheme Procedure} fixnum->flonum fx
1783Returns the flonum that is numerically closest to the fixnum @var{fx}.
1784@end deffn
1785
1786@node rnrs arithmetic bitwise
1787@subsubsection rnrs arithmetic bitwise
1788
1789The @code{(rnrs arithmetic bitwise (6))} library provides procedures for
1790performing bitwise arithmetic operations on the two's complement
5b379729
JG
1791representations of fixnums.
1792
1793This library and the procedures it exports share functionality with
1794SRFI-60, which provides support for bitwise manipulation of integers
1795(@pxref{SRFI-60}).
ea28e981
JG
1796
1797@deffn {Scheme Procedure} bitwise-not ei
1798@deffnx {Scheme Procedure} bitwise-and ei1 ...
1799@deffnx {Scheme Procedure} bitwise-ior ei1 ...
1800@deffnx {Scheme Procedure} bitwise-xor ei1 ...
1801These procedures are identical to the @code{lognot}, @code{logand},
1802@code{logior}, and @code{logxor} procedures provided by Guile's core
1803library. @xref{Bitwise Operations}, for documentation.
1804@end deffn
1805
1806@deffn {Scheme Procedure} bitwise-if ei1 ei2 ei3
1807Returns the bitwise ``if'' of its arguments. The bit at position
1808@code{i} in the return value will be the @code{i}th bit from @var{ei2}
1809if the @code{i}th bit of @var{ei1} is 1, the @code{i}th bit from
1810@var{ei3}.
1811@end deffn
1812
1813@deffn {Scheme Procedure} bitwise-bit-count ei
1814Returns the number of 1 bits in the two's complement representation of
1815@var{ei}.
1816@end deffn
1817
1818@deffn {Scheme Procedure} bitwise-length ei
1819Returns the number of bits necessary to represent @var{ei}.
1820@end deffn
1821
1822@deffn {Scheme Procedure} bitwise-first-bit-set ei
1823Returns the index of the least significant 1 bit in the two's complement
1824representation of @var{ei}.
1825@end deffn
1826
1827@deffn {Scheme Procedure} bitwise-bit-set? ei1 ei2
1828Returns @code{#t} if the @var{ei2}th bit in the two's complement
1829representation of @var{ei1} is 1, @code{#f} otherwise.
1830@end deffn
1831
1832@deffn {Scheme Procedure} bitwise-copy-bit ei1 ei2 ei3
1833Returns the result of setting the @var{ei2}th bit of @var{ei1} to the
1834@var{ei2}th bit of @var{ei3}.
1835@end deffn
1836
1837@deffn {Scheme Procedure} bitwise-bit-field ei1 ei2 ei3
1838Returns the integer representation of the contiguous sequence of bits in
1839@var{ei1} that starts at position @var{ei2} (inclusive) and ends at
1840position @var{ei3} (exclusive).
1841@end deffn
1842
1843@deffn {Scheme Procedure} bitwise-copy-bit-field ei1 ei2 ei3 ei4
1844Returns the result of replacing the bit field in @var{ei1} with start
1845and end positions @var{ei2} and @var{ei3} with the corresponding bit
1846field from @var{ei4}.
1847@end deffn
1848
1849@deffn {Scheme Procedure} bitwise-arithmetic-shift ei1 ei2
1850@deffnx {Scheme Procedure} bitwise-arithmetic-shift-left ei1 ei2
1851@deffnx {Scheme Procedure} bitwise-arithmetic-shift-right ei1 ei2
1852Returns the result of shifting the bits of @var{ei1} right or left by
1853the @var{ei2} positions. @code{bitwise-arithmetic-shift} is identical
1854to @code{bitwise-arithmetic-shift-left}.
1855@end deffn
1856
1857@deffn {Scheme Procedure} bitwise-rotate-bit-field ei1 ei2 ei3 ei4
1858Returns the result of cyclically permuting the bit field in @var{ei1}
1859with start and end positions @var{ei2} and @var{ei3} by @var{ei4} bits
1860in the direction of more significant bits.
1861@end deffn
1862
1863@deffn {Scheme Procedure} bitwise-reverse-bit-field ei1 ei2 ei3
1864Returns the result of reversing the order of the bits of @var{e1}
1865between position @var{ei2} (inclusive) and position @var{ei3}
1866(exclusive).
1867@end deffn
1868
1869@node rnrs syntax-case
1870@subsubsection rnrs syntax-case
1871
1872The @code{(rnrs syntax-case (6))} library provides access to the
1873@code{syntax-case} system for writing hygienic macros. With one
1874exception, all of the forms and procedures exported by this library
1875are ``re-exports'' of Guile's native support for @code{syntax-case};
5b379729 1876@xref{Syntax Case}, for documentation, examples, and rationale.
ea28e981
JG
1877
1878@deffn {Scheme Procedure} make-variable-transformer proc
1879Creates a new variable transformer out of @var{proc}, a procedure that
1880takes a syntax object as input and returns a syntax object. If an
1881identifier to which the result of this procedure is bound appears on the
1882left-hand side of a @code{set!} expression, @var{proc} will be called
1883with a syntax object representing the entire @code{set!} expression,
1884and its return value will replace that @code{set!} expression.
1885@end deffn
1886
1887@deffn {Scheme Syntax} syntax-case expression (literal ...) clause ...
1888The @code{syntax-case} pattern matching form.
1889@end deffn
1890
1891@deffn {Scheme Syntax} syntax template
1892@deffnx {Scheme Syntax} quasisyntax template
1893@deffnx {Scheme Syntax} unsyntax template
1894@deffnx {Scheme Syntax} unsyntax-splicing template
1895These forms allow references to be made in the body of a syntax-case
1896output expression subform to datum and non-datum values. They are
1897identical to the forms provided by Guile's core library;
5b379729 1898@xref{Syntax Case}, for documentation.
ea28e981
JG
1899@end deffn
1900
1901@deffn {Scheme Procedure} identifier? obj
1902@deffnx {Scheme Procedure} bound-identifier=? id1 id2
1903@deffnx {Scheme Procedure} free-identifier=? id1 id2
1904These predicate procedures operate on syntax objects representing
1905Scheme identifiers. @code{identifier?} returns @code{#t} if @var{obj}
1906represents an identifier, @code{#f} otherwise.
1907@code{bound-identifier=?} returns @code{#t} if and only if a binding for
1908@var{id1} would capture a reference to @var{id2} in the transformer's
1909output, or vice-versa. @code{free-identifier=?} returns @code{#t} if
1910and only @var{id1} and @var{id2} would refer to the same binding in the
1911output of the transformer, independent of any bindings introduced by the
1912transformer.
1913@end deffn
1914
1915@deffn {Scheme Procedure} generate-temporaries l
1916Returns a list, of the same length as @var{l}, which must be a list or
1917a syntax object representing a list, of globally unique symbols.
1918@end deffn
1919
1920@deffn {Scheme Procedure} syntax->datum syntax-object
1921@deffnx {Scheme Procedure} datum->syntax template-id datum
1922These procedures convert wrapped syntax objects to and from Scheme datum
1923values. The syntax object returned by @code{datum->syntax} shares
1924contextual information with the syntax object @var{template-id}.
1925@end deffn
1926
1927@deffn {Scheme Procedure} syntax-violation whom message form
1928@deffnx {Scheme Procedure} syntax-violation whom message form subform
1929Constructs a new compound condition that includes the following
1930simple conditions:
1931@itemize @bullet
1932@item
1933If @var{whom} is not @code{#f}, a @code{&who} condition with the
1934@var{whom} as its field
1935@item
1936A @code{&message} condition with the specified @var{message}
1937@item
1938A @code{&syntax} condition with the specified @var{form} and optional
1939@var{subform} fields
1940@end itemize
1941@end deffn
1942
1943@node rnrs hashtables
1944@subsubsection rnrs hashtables
1945
1946The @code{(rnrs hashtables (6))} library provides structures and
1947procedures for creating and accessing hash tables. The hash tables API
1948defined by R6RS is substantially similar to both Guile's native hash
5b379729
JG
1949tables implementation as well as the one provided by SRFI-69;
1950@xref{Hash Tables}, and @ref{SRFI-69}, respectively. Note that you can
1951write portable R6RS library code that manipulates SRFI-69 hash tables
1952(by importing the @code{(srfi :69)} library); however, hash tables
1953created by one API cannot be used by another.
1954
1955Like SRFI-69 hash tables---and unlike Guile's native ones---R6RS hash
1956tables associate hash and equality functions with a hash table at the
1957time of its creation. Additionally, R6RS allows for the creation
ea28e981
JG
1958(via @code{hashtable-copy}; see below) of immutable hash tables.
1959
1960@deffn {Scheme Procedure} make-eq-hashtable
1961@deffnx {Scheme Procedure} make-eq-hashtable k
1962Returns a new hash table that uses @code{eq?} to compare keys and
1963Guile's @code{hashq} procedure as a hash function. If @var{k} is given,
1964it specifies the initial capacity of the hash table.
1965@end deffn
1966
1967@deffn {Scheme Procedure} make-eqv-hashtable
1968@deffnx {Scheme Procedure} make-eqv-hashtable k
1969Returns a new hash table that uses @code{eqv?} to compare keys and
1970Guile's @code{hashv} procedure as a hash function. If @var{k} is given,
1971it specifies the initial capacity of the hash table.
1972@end deffn
1973
1974@deffn {Scheme Procedure} make-hashtable hash-function equiv
1975@deffnx {Scheme Procedure} make-hashtable hash-function equiv k
1976Returns a new hash table that uses @var{equiv} to compare keys and
1977@var{hash-function} as a hash function. @var{equiv} must be a procedure
1978that accepts two arguments and returns a true value if they are
1979equivalent, @code{#f} otherwise; @var{hash-function} must be a procedure
1980that accepts one argument and returns a non-negative integer.
1981
1982If @var{k} is given, it specifies the initial capacity of the hash
1983table.
1984@end deffn
1985
1986@deffn {Scheme Procedure} hashtable? obj
1987Returns @code{#t} if @var{obj} is an R6RS hash table, @code{#f}
1988otherwise.
1989@end deffn
1990
1991@deffn {Scheme Procedure} hashtable-size hashtable
1992Returns the number of keys currently in the hash table @var{hashtable}.
1993@end deffn
1994
1995@deffn {Scheme Procedure} hashtable-ref hashtable key default
1996Returns the value associated with @var{key} in the hash table
1997@var{hashtable}, or @var{default} if none is found.
1998@end deffn
1999
2000@deffn {Scheme Procedure} hashtable-set! hashtable key obj
2001Associates the key @var{key} with the value @var{obj} in the hash table
2002@var{hashtable}, and returns an unspecified value. An @code{&assertion}
2003condition is raised if @var{hashtable} is immutable.
2004@end deffn
2005
2006@deffn {Scheme Procedure} hashtable-delete! hashtable key
2007Removes any association found for the key @var{key} in the hash table
2008@var{hashtable}, and returns an unspecified value. An @code{&assertion}
2009condition is raised if @var{hashtable} is immutable.
2010@end deffn
2011
2012@deffn {Scheme Procedure} hashtable-contains? hashtable key
2013Returns @code{#t} if the hash table @var{hashtable} contains an
2014association for the key @var{key}, @code{#f} otherwise.
2015@end deffn
2016
2017@deffn {Scheme Procedure} hashtable-update! hashtable key proc default
2018Associates with @var{key} in the hash table @var{hashtable} the result
2019of calling @var{proc}, which must be a procedure that takes one
2020argument, on the value currently associated @var{key} in
5b379729 2021@var{hashtable}---or on @var{default} if no such association exists.
ea28e981
JG
2022An @code{&assertion} condition is raised if @var{hashtable} is
2023immutable.
2024@end deffn
2025
2026@deffn {Scheme Procedure} hashtable-copy hashtable
2027@deffnx {Scheme Procedure} hashtable-copy hashtable mutable
2028Returns a copy of the hash table @var{hashtable}. If the optional
2029argument @var{mutable} is a true value, the new hash table will be
2030immutable.
2031@end deffn
2032
2033@deffn {Scheme Procedure} hashtable-clear! hashtable
2034@deffnx {Scheme Procedure} hashtable-clear! hashtable k
2035Removes all of the associations from the hash table @var{hashtable}.
2036The optional argument @var{k}, which specifies a new capacity for the
2037hash table, is accepted by Guile's @code{(rnrs hashtables)}
2038implementation, but is ignored.
2039@end deffn
2040
2041@deffn {Scheme Procedure} hashtable-keys hashtable
2042Returns a vector of the keys with associations in the hash table
2043@var{hashtable}, in an unspecified order.
2044@end deffn
2045
2046@deffn {Scheme Procedure} hashtable-entries hashtable
5b379729
JG
2047Return two values---a vector of the keys with associations in the hash
2048table @var{hashtable}, and a vector of the values to which these keys
2049are mapped, in corresponding but unspecified order.
ea28e981
JG
2050@end deffn
2051
2052@deffn {Scheme Procedure} hashtable-equivalence-function hashtable
2053Returns the equivalence predicated use by @var{hashtable}. This
2054procedure returns @code{eq?} and @code{eqv?}, respectively, for hash
2055tables created by @code{make-eq-hashtable} and
2056@code{make-eqv-hashtable}.
2057@end deffn
2058
2059@deffn {Scheme Procedure} hashtable-hash-function hashtable
2060Returns the hash function used by @var{hashtable}. For hash tables
2061created by @code{make-eq-hashtable} or @code{make-eqv-hashtable},
2062@code{#f} is returned.
2063@end deffn
2064
2065@deffn {Scheme Procedure} hashtable-mutable? hashtable
2066Returns @code{#t} if @var{hashtable} is mutable, @code{#f} otherwise.
2067@end deffn
2068
2069A number of hash functions are provided for convenience:
2070
2071@deffn {Scheme Procedure} equal-hash obj
2072Returns an integer hash value for @var{obj}, based on its structure and
2073current contents. This hash function is suitable for use with
2074@code{equal?} as an equivalence function.
2075@end deffn
2076
2077@deffn {Scheme Procedure} string-hash string
2078@deffnx {Scheme Procedure} symbol-hash symbol
2079These procedures are identical to the ones provided by Guile's core
2080library. @xref{Hash Table Reference}, for documentation.
2081@end deffn
2082
2083@deffn {Scheme Procedure} string-ci-hash string
2084Returns an integer hash value for @var{string} based on its contents,
2085ignoring case. This hash function is suitable for use with
2086@code{string-ci=?} as an equivalence function.
2087@end deffn
2088
2089@node rnrs enums
2090@subsubsection rnrs enums
2091
2092The @code{(rnrs enums (6))} library provides structures and procedures
2093for working with enumerable sets of symbols. Guile's implementation
2094defines an @dfn{enum-set} record type that encapsulates a finite set of
2095distinct symbols, the @dfn{universe}, and a subset of these symbols,
2096which define the enumeration set.
2097
2098The SRFI-1 list library provides a number of procedures for performing
2099set operations on lists; Guile's @code{(rnrs enums)} implementation
2100makes use of several of them. @xref{SRFI-1 Set Operations}, for
2101more information.
2102
2103@deffn {Scheme Procedure} make-enumeration symbol-list
2104Returns a new enum-set whose universe and enumeration set are both equal
2105to @var{symbol-list}, a list of symbols.
2106@end deffn
2107
2108@deffn {Scheme Procedure} enum-set-universe enum-set
2109Returns an enum-set representing the universe of @var{enum-set},
2110an enum-set.
2111@end deffn
2112
2113@deffn {Scheme Procedure} enum-set-indexer enum-set
2114Returns a procedure that takes a single argument and returns the
2115zero-indexed position of that argument in the universe of
2116@var{enum-set}, or @code{#f} if its argument is not a member of that
2117universe.
2118@end deffn
2119
2120@deffn {Scheme Procedure} enum-set-constructor enum-set
2121Returns a procedure that takes a single argument, a list of symbols
2122from the universe of @var{enum-set}, an enum-set, and returns a new
2123enum-set with the same universe that represents a subset containing the
2124specified symbols.
2125@end deffn
2126
2127@deffn {Scheme Procedure} enum-set->list enum-set
2128Returns a list containing the symbols of the set represented by
2129@var{enum-set}, an enum-set, in the order that they appear in the
2130universe of @var{enum-set}.
2131@end deffn
2132
2133@deffn {Scheme Procedure} enum-set-member? symbol enum-set
2134@deffnx {Scheme Procedure} enum-set-subset? enum-set1 enum-set2
2135@deffnx {Scheme Procedure} enum-set=? enum-set1 enum-set2
2136These procedures test for membership of symbols and enum-sets in other
2137enum-sets. @code{enum-set-member?} returns @code{#t} if and only if
2138@var{symbol} is a member of the subset specified by @var{enum-set}.
2139@code{enum-set-subset?} returns @code{#t} if and only if the universe of
2140@var{enum-set1} is a subset of the universe of @var{enum-set2} and
2141every symbol in @var{enum-set1} is present in @var{enum-set2}.
2142@code{enum-set=?} returns @code{#t} if and only if @var{enum-set1} is a
2143subset, as per @code{enum-set-subset?} of @var{enum-set2} and vice
2144versa.
2145@end deffn
2146
2147@deffn {Scheme Procedure} enum-set-union enum-set1 enum-set2
2148@deffnx {Scheme Procedure} enum-set-intersection enum-set1 enum-set2
2149@deffnx {Scheme Procedure} enum-set-difference enum-set1 enum-set2
2150These procedures return, respectively, the union, intersection, and
2151difference of their enum-set arguments.
2152@end deffn
2153
2154@deffn {Scheme Procedure} enum-set-complement enum-set
2155Returns @var{enum-set}'s complement (an enum-set), with regard to its
2156universe.
2157@end deffn
2158
2159@deffn {Scheme Procedure} enum-set-projection enum-set1 enum-set2
2160Returns the projection of the enum-set @var{enum-set1} onto the universe
2161of the enum-set @var{enum-set2}.
2162@end deffn
2163
2164@deffn {Scheme Syntax} define-enumeration type-name (symbol ...) constructor-syntax
2165Evaluates to two new definitions: A constructor bound to
2166@var{constructor-syntax} that behaves similarly to constructors created
2167by @code{enum-set-constructor}, above, and creates new @var{enum-set}s
2168in the universe specified by @code{(symbol ...)}; and a ``predicate
2169macro'' bound to @var{type-name}, which has the following form:
2170
2171@lisp
2172(@var{type-name} sym)
2173@end lisp
2174
2175If @var{sym} is a member of the universe specified by the @var{symbol}s
2176above, this form evaluates to @var{sym}. Otherwise, a @code{&syntax}
2177condition is raised.
2178@end deffn
2179
2180@node rnrs
2181@subsubsection rnrs
2182
2183The @code{(rnrs (6))} library is a composite of all of the other R6RS
5b379729
JG
2184standard libraries---it imports and re-exports all of their exported
2185procedures and syntactic forms---with the exception of the following
ea28e981
JG
2186libraries:
2187
2188@itemize @bullet
2189@item @code{(rnrs eval (6))}
2190@item @code{(rnrs mutable-pairs (6))}
2191@item @code{(rnrs mutable-strings (6))}
2192@item @code{(rnrs r5rs (6))}
2193@end itemize
2194
2195@node rnrs eval
2196@subsubsection rnrs eval
2197
2198The @code{(rnrs eval (6)} library provides procedures for performing
2199``on-the-fly'' evaluation of expressions.
2200
2201@deffn {Scheme Procedure} eval expression environment
2202Evaluates @var{expression}, which must be a datum representation of a
2203valid Scheme expression, in the environment specified by
2204@var{environment}. This procedure is identical to the one provided by
5b379729 2205Guile's code library; @xref{Fly Evaluation}, for documentation.
ea28e981
JG
2206@end deffn
2207
2208@deffn {Scheme Procedure} environment import-spec ...
2209Constructs and returns a new environment based on the specified
2210@var{import-spec}s, which must be datum representations of the import
2211specifications used with the @code{import} form. @xref{R6RS Libraries},
2212for documentation.
2213@end deffn
2214
2215@node rnrs mutable-pairs
2216@subsubsection rnrs mutable-pairs
2217
2218The @code{(rnrs mutable-pairs (6))} library provides the @code{set-car!}
2219and @code{set-cdr!} procedures, which allow the @code{car} and
2220@code{cdr} fields of a pair to be modified.
2221
2222These procedures are identical to the ones provide by Guile's core
2223library. @xref{Pairs}, for documentation. All pairs in Guile are
2224mutable; consequently, these procedures will never throw the
2225@code{&assertion} condition described in the R6RS libraries
2226specification.
2227
2228@node rnrs mutable-strings
2229@subsubsection rnrs mutable-strings
2230
2231The @code{(rnrs mutable-strings (6))} library provides the
2232@code{string-set!} and @code{string-fill!} procedures, which allow the
2233content of strings to be modified ``in-place.''
2234
2235These procedures are identical to the ones provided by Guile's core
2236library. @xref{String Modification}, for documentation. All strings in
2237Guile are mutable; consequently, these procedures will never throw the
2238@code{&assertion} condition described in the R6RS libraries
2239specification.
2240
2241@node rnrs r5rs
2242@subsubsection rnrs r5rs
2243
2244The @code{(rnrs r5rs (6))} library exports bindings for some procedures
2245present in R5RS but omitted from the R6RS base library specification.
2246
2247@deffn {Scheme Procedure} exact->inexact z
2248@deffnx {Scheme Procedure} inexact->exact z
2249These procedures are identical to the ones provided by Guile's core
2250library. @xref{Exactness}, for documentation.
2251@end deffn
2252
2253@deffn {Scheme Procedure} quotient n1 n2
2254@deffnx {Scheme Procedure} remainder n1 n2
2255@deffnx {Scheme Procedure} modulo n1 n2
2256These procedures are identical to the ones provided by Guile's core
2257library. @xref{Integer Operations}, for documentation.
2258@end deffn
2259
2260@deffn {Scheme Syntax} delay expr
2261@deffnx {Scheme Procedure} force promise
2262The @code{delay} form and the @code{force} procedure are identical to
2263their counterparts in Guile's core library. @xref{Delayed Evaluation},
2264for documentation.
2265@end deffn
2266
2267@deffn {Scheme Procedure} null-environment n
2268@deffnx {Scheme Procedure} scheme-report-environment n
2269These procedures are identical to the ones provided by the
2270@code{(ice-9 r5rs)} Guile module. @xref{Environments}, for
2271documentation.
2272@end deffn
845cbcfe
AW
2273
2274@c r6rs.texi ends here
2275
2276@c Local Variables:
2277@c TeX-master: "guile.texi"
2278@c End: