add section on toplevel expansion to r6rs incompatibilities
[bpt/guile.git] / doc / ref / r6rs.texi
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
12 their 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
22 There are some incompatibilities between Guile and the R6RS. Some of
23 them are intentional, some of them are bugs, and some are simply
24 unimplemented features. Please let the Guile developers know if you
25 find one that is not on this list.
26
27 @itemize
28 @item
29 The R6RS specifies many situations in which a conforming implementation
30 must signal a specific error. Guile doesn't really care about that too
31 much---if a correct R6RS program would not hit that error, we don't
32 bother checking for it.
33
34 @item
35 Multiple @code{library} forms in one file are not yet supported. This
36 is because the expansion of @code{library} sets the current module, but
37 does not restore it. This is a bug.
38
39 @item
40 A @code{set!} to a variable transformer may only expand to an
41 expression, not a definition---even if the original @code{set!}
42 expression was in definition context.
43
44 @item
45 Instead of using the algorithm detailed in chapter 10 of the R6RS,
46 expansion of toplevel forms happens sequentially.
47
48 For example, while the expansion of the following set of recursive
49 nested 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
64 The 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
79 This is because when expanding the right-hand-side of @code{even?}, the
80 reference to @code{odd?} is not yet marked as a syntax transformer, so
81 it is assumed to be a function.
82
83 While it is likely that we can fix the case of toplevel forms nested in
84 a @code{begin} or a @code{library} form, a fix for toplevel programs
85 seems trickier to implement in a backward-compatible way. Suggestions
86 and/or patches would be appreciated.
87 @end itemize
88
89 @node R6RS Standard Libraries
90 @subsection R6RS Standard Libraries
91
92 In contrast with earlier versions of the Revised Report, the R6RS
93 organizes the procedures and syntactic forms required of conforming
94 implementations into a set of ``standard libraries'' which can be
95 imported as necessary by user programs and libraries. Here we briefly
96 list the libraries that have been implemented for Guile.
97
98 We do not attempt to document these libraries fully here, as most of
99 their functionality is already available in Guile itself. The
100 expectation is that most Guile users will use the well-known and
101 well-documented Guile modules. These R6RS libraries are mostly useful
102 to users who want to port their code to other R6RS systems.
103
104 The documentation in the following sections reproduces some of the
105 content of the library section of the Report, but is mostly intended to
106 provide supplementary information about Guile's implementation of the
107 R6RS standard libraries. For complete documentation, design rationales
108 and further examples, we advise you to consult the ``Standard
109 Libraries'' section of the Report (@pxref{Standard Libraries,
110 R6RS Standard Libraries,, r6rs, The Revised^6 Report on the Algorithmic
111 Language 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
153 Guile implements the R6RS `library' form as a transformation to a native
154 Guile module definition. As a consequence of this, all of the libraries
155 described in the following subsections, in addition to being available
156 for use by R6RS libraries and top-level programs, can also be imported
157 as if they were normal Guile modules---via a @code{use-modules} form,
158 say. For example, the R6RS ``composite'' library can be imported by:
159
160 @lisp
161 (import (rnrs (6)))
162 @end lisp
163
164 @lisp
165 (use-modules ((rnrs) :version (6)))
166 @end lisp
167
168 For more information on Guile's library implementation, see
169 (@pxref{R6RS Libraries}).
170
171 @node rnrs base
172 @subsubsection rnrs base
173
174 The @code{(rnrs base (6))} library exports the procedures and syntactic
175 forms described in the main section of the Report
176 (@pxref{Base library, R6RS Base library,, r6rs,
177 The Revised^6 Report on the Algorithmic Language Scheme}). They are
178 grouped 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
280 @deffnx {Scheme Syntax} letrec* bindings body
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
386 @deffn {Scheme Procedure} for-each f lst1 lst2 ...
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
460 These 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
469 These procedures are similar to @code{div}, @code{mod}, and
470 @code{div-and-mod}, except that @code{mod0} returns values that lie
471 within a half-open interval centered on zero.
472 @end deffn
473
474 @deffn {Scheme Procedure} exact-integer-sqrt k
475 This 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
482 These procedures return @code{#t} if and only if their arguments can,
483 respectively, be coerced to a real, rational, or integer value without a
484 loss of numerical precision.
485
486 @code{real-valued?} will return @code{#t} for complex numbers whose
487 imaginary 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
498 Raises 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 ...
504 These procedures raise compound conditions based on their arguments:
505 If @var{who} is not @code{#f}, the condition will include a @code{&who}
506 condition whose @code{who} field is set to @var{who}; a @code{&message}
507 condition 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
512 described 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
519 These procedures implement the @code{map} and @code{for-each} contracts
520 over 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
560 The @code{(rnrs unicode (6))} library provides procedures for
561 manipulating 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
567 These procedures translate their arguments from one Unicode character
568 set to another. @code{char-upcase}, @code{char-downcase}, and
569 @code{char-titlecase} are identical to their counterparts in the
570 Guile core library; @xref{Characters}, for documentation.
571
572 @code{char-foldcase} returns the result of applying @code{char-upcase}
573 to its argument, followed by @code{char-downcase}---except in the case
574 of the Turkic characters @code{U+0130} and @code{U+0131}, for which the
575 procedure 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 ...
583 These procedures facilitate case-insensitive comparison of Unicode
584 characters. They are identical to the procedures provided by Guile's
585 core 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
594 These procedures implement various Unicode character set predicates.
595 They 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
607 These 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 ...
616 These 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
624 These procedures perform Unicode string normalization operations on
625 their input. @xref{String Comparison}, for documentation.
626 @end deffn
627
628 @node rnrs bytevectors
629 @subsubsection rnrs bytevectors
630
631 The @code{(rnrs bytevectors (6))} library provides procedures for
632 working with blocks of binary data. This functionality is documented
633 in its own section of the manual; @xref{Bytevectors}.
634
635 @node rnrs lists
636 @subsubsection rnrs lists
637
638 The @code{(rnrs lists (6))} library provides procedures additional
639 procedures for working with lists.
640
641 @deffn {Scheme Procedure} find proc list
642 This procedure is identical to the one defined in Guile's SRFI-1
643 implementation. @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
649 The @code{for-all} procedure is identical to the @code{every} procedure
650 defined 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
656 These procedures are identical to the ones provided by SRFI-1.
657 @xref{List Modification}, for a description of @code{filter};
658 @xref{SRFI-1 Filtering and Partitioning}, for @code{partition}.
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
663 These procedures are identical to the @code{fold} and @code{fold-right}
664 procedures provided by SRFI-1. @xref{SRFI-1 Fold and Map}, for
665 documentation.
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
674 Guile's core library, (@pxref{List Modification}). @code{remp} is
675 identical to the alternate @code{remove} procedure provided by SRFI-1;
676 @xref{SRFI-1 Deleting}.
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
684 procedures provided by Guile's core library; @xref{List Searching},
685 for their documentation. @code{memp} uses the specified predicate
686 function @code{proc} to test elements of the list @var{list}---it
687 behaves similarly to @code{find}, except that it returns the first
688 sublist 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
696 procedures provided by Guile's core library;
697 @xref{Alist Key Equality}, for their documentation. @code{assp} uses
698 the specified predicate function @code{proc} to test keys in the
699 association list @var{alist}.
700 @end deffn
701
702 @deffn {Scheme Procedure} cons* obj1 ... obj
703 @deffnx {Scheme Procedure} cons* obj
704 This procedure is identical to the one exported by Guile's core
705 library. @xref{List Constructors}, for documentation.
706 @end deffn
707
708 @node rnrs sorting
709 @subsubsection rnrs sorting
710
711 The @code{(rnrs sorting (6))} library provides procedures for sorting
712 lists and vectors.
713
714 @deffn {Scheme Procedure} list-sort proc list
715 @deffnx {Scheme Procedure} vector-sort proc vector
716 These procedures return their input sorted in ascending order, without
717 modifying the original data. @var{proc} must be a procedure that takes
718 two elements from the input list or vector as arguments, and returns a
719 true value if the first is ``less'' than the second, @code{#f}
720 otherwise. @code{list-sort} returns a list; @code{vector-sort} returns
721 a vector.
722
723 Both @code{list-sort} and @code{vector-sort} are implemented in terms of
724 the @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
729 Performs a destructive, ``in-place'' sort of @var{vector}, using
730 @var{proc} as described above to determine an ascending ordering of
731 elements. @code{vector-sort!} returns an unspecified value.
732
733 This procedure is implemented in terms of the @code{sort!} procedure
734 from Guile's core library. @xref{Sorting}, for more information.
735 @end deffn
736
737 @node rnrs control
738 @subsubsection rnrs control
739
740 The @code{(rnrs control (6))} library provides syntactic forms useful
741 for constructing conditional expressions and controlling the flow of
742 execution.
743
744 @deffn {Scheme Syntax} when test expression1 expression2 ...
745 @deffnx {Scheme Syntax} unless test expression1 expression2 ...
746 The @code{when} form is evaluated by evaluating the specified @var{test}
747 expression; if the result is a true value, the @var{expression}s that
748 follow it are evaluated in order, and the value of the final
749 @var{expression} becomes the value of the entire @code{when} expression.
750
751 The @code{unless} form behaves similarly, with the exception that the
752 specified @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 ...
757 This 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 ...
762 This 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
769 The manual sections below describe Guile's implementation of R6RS
770 records, which provide support for user-defined data types. The R6RS
771 records API provides a superset of the features provided by Guile's
772 ``native'' records, as well as those of the SRFI-9 records API;
773 @xref{Records}, and @ref{SRFI-9}, for a description of those
774 interfaces.
775
776 As with SRFI-9 and Guile's native records, R6RS records are constructed
777 using a record-type descriptor that specifies attributes like the
778 record's name, its fields, and the mutability of those fields.
779
780 R6RS records extend this framework to support single inheritance via the
781 specification of a ``parent'' type for a record type at definition time.
782 Accessors and mutator procedures for the fields of a parent type may be
783 applied 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
785 record type.
786
787 The inheritance mechanism for record types also informs the process of
788 initializing the fields of a record and its parents. Constructor
789 procedures that generate new instances of a record type are obtained
790 from a record constructor descriptor, which encapsulates the record-type
791 descriptor of the record to be constructed along with a @dfn{protocol}
792 procedure that defines how constructors for record subtypes delegate to
793 the constructors of their parent types.
794
795 A protocol is a procedure used by the record system at construction time
796 to bind arguments to the fields of the record being constructed. The
797 protocol procedure is passed a procedure @var{n} that accepts the
798 arguments required to construct the record's parent type; this
799 procedure, when invoked, will return a procedure @var{p} that accepts
800 the arguments required to construct a new instance of the record type
801 itself and returns a new instance of the record type.
802
803 The 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
805 type(s). This procedure will be the constructor returned by
806
807 As 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
810 additional coordinate. The following protocol produces a constructor
811 procedure that accepts all three coordinates, uses the first two to
812 initialize the fields of @code{pixel}, and binds the third to the single
813 field 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
822 It may be helpful to think of protocols as ``constructor factories''
823 that produce chains of delegating constructors glued together by the
824 helper procedure @var{n}.
825
826 An R6RS record type may be declared to be @dfn{nongenerative} via the
827 use of a unique generated or user-supplied symbol---or
828 @dfn{uid}---such that subsequent record type declarations with the same
829 uid and attributes will return the previously-declared record-type
830 descriptor.
831
832 R6RS record types may also be declared to be @dfn{opaque}, in which case
833 the various predicates and introspection procedures defined in
834 @code{(rnrs records introspection)} will behave as if records of this
835 type are not records at all.
836
837 Note that while the R6RS records API shares much of its namespace with
838 both the SRFI-9 and native Guile records APIs, it is not currently
839 compatible with either.
840
841 @node rnrs records syntactic
842 @subsubsection rnrs records syntactic
843
844 The @code{(rnrs records syntactic (6))} library exports the syntactic
845 API for working with R6RS records.
846
847 @deffn {Scheme Syntax} define-record-type name-spec record-clause*
848 Defines a new record type, introducing bindings for a record-type
849 descriptor, a record constructor descriptor, a constructor procedure,
850 a record predicate, and accessor and mutator procedures for the new
851 record 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
856 all identifiers and specify the names to which, respectively, the
857 record-type descriptor, constructor, and predicate procedures will be
858 bound. If @var{name-spec} is only an identifier, it specifies the name
859 to which the generated record-type descriptor will be bound.
860
861 Each @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
866 field 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
870 immutable field with the name @var{field-name} and binds an accessor
871 procedure for it to the name given by @var{accessor-name}
872 @item
873 @code{(mutable field-name accessor-name mutator-name)}, which specifies
874 a mutable field with the name @var{field-name} and binds accessor and
875 mutator procedures to @var{accessor-name} and @var{mutator-name},
876 respectively
877 @item
878 @code{(immutable field-name)}, which specifies an immutable field with
879 the name @var{field-name}; an accessor procedure for it will be created
880 and named by appending record name and @var{field-name} with a hyphen
881 separator
882 @item
883 @code{(mutable field-name}), which specifies a mutable field with the
884 name @var{field-name}; an accessor procedure for it will be created and
885 named as described above; a mutator procedure will also be created and
886 named 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
890 as described above
891 @end itemize
892 @item
893 @code{(parent parent-name)}, where @var{parent-name} is a symbol giving
894 the name of the record type to be used as the parent of the new record
895 type
896 @item
897 @code{(protocol expression)}, where @var{expression} evaluates to a
898 protocol procedure which behaves as described above, and is used to
899 create a record constructor descriptor for the new record type
900 @item
901 @code{(sealed sealed?)}, where @var{sealed?} is a boolean value that
902 specifies whether or not the new record type is sealed
903 @item
904 @code{(opaque opaque?)}, where @var{opaque?} is a boolean value that
905 specifies whether or not the new record type is opaque
906 @item
907 @code{(nongenerative [uid])}, which specifies that the record type is
908 nongenerative via the optional uid @var{uid}. If @var{uid} is not
909 specified, 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
913 evaluate to a record-type descriptor and a record constructor
914 descriptor, respectively
915 @end itemize
916 @end deffn
917
918 @deffn {Scheme Syntax} record-type-descriptor record-name
919 Evaluates to the record-type descriptor associated with the type
920 specified by @var{record-name}.
921 @end deffn
922
923 @deffn {Scheme Syntax} record-constructor-descriptor record-name
924 Evaluates to the record-constructor descriptor associated with the type
925 specified by @var{record-name}.
926 @end deffn
927
928 @node rnrs records procedural
929 @subsubsection rnrs records procedural
930
931 The @code{(rnrs records procedural (6))} library exports the procedural
932 API for working with R6RS records.
933
934 @deffn {Scheme Procedure} make-record-type-descriptor name parent uid sealed? opaque? fields
935 Returns 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
938 descriptor for the returned record type to extend; @var{uid} must be
939 either @code{#f}, indicating that the record type is generative, or
940 a symbol giving the type's nongenerative uid; @var{sealed?} and
941 @var{opaque?} must be boolean values that specify the sealedness and
942 opaqueness of the record type; @var{fields} must be a vector of zero or
943 more field specifiers of the form @code{(mutable name)} or
944 @code{(immutable name)}, where name is a symbol giving a name for the
945 field.
946
947 If @var{uid} is not @code{#f}, it must be a symbol
948 @end deffn
949
950 @deffn {Scheme Procedure} record-type-descriptor? obj
951 Returns @code{#t} if @var{obj} is a record-type descriptor, @code{#f}
952 otherwise.
953 @end deffn
954
955 @deffn {Scheme Procedure} make-record-constructor-descriptor rtd parent-constructor-descriptor protocol
956 Returns a new record constructor descriptor that can be used to produce
957 constructors for the record type specified by the record-type descriptor
958 @var{rtd} and whose delegation and binding behavior are specified by the
959 protocol procedure @var{protocol}.
960
961 @var{parent-constructor-descriptor} specifies a record constructor
962 descriptor 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}
965 is an extension of another type, @var{parent-constructor-descriptor} may
966 still be @code{#f}, but protocol must also be @code{#f} in this case.
967 @end deffn
968
969 @deffn {Scheme Procedure} record-constructor rcd
970 Returns a record constructor procedure by invoking the protocol
971 defined by the record-constructor descriptor @var{rcd}.
972 @end deffn
973
974 @deffn {Scheme Procedure} record-predicate rtd
975 Returns the record predicate procedure for the record-type descriptor
976 @var{rtd}.
977 @end deffn
978
979 @deffn {Scheme Procedure} record-accessor rtd k
980 Returns the record field accessor procedure for the @var{k}th field of
981 the record-type descriptor @var{rtd}.
982 @end deffn
983
984 @deffn {Scheme Procedure} record-mutator rtd k
985 Returns the record field mutator procedure for the @var{k}th field of
986 the record-type descriptor @var{rtd}. An @code{&assertion} condition
987 will be raised if this field is not mutable.
988 @end deffn
989
990 @node rnrs records inspection
991 @subsubsection rnrs records inspection
992
993 The @code{(rnrs records inspection (6))} library provides procedures
994 useful for accessing metadata about R6RS records.
995
996 @deffn {Scheme Procedure} record? obj
997 Return @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
1002 Returns 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
1007 Returns the name of the record-type descriptor @var{rtd}.
1008 @end deffn
1009
1010 @deffn {Scheme Procedure} record-type-parent rtd
1011 Returns the parent of the record-type descriptor @var{rtd}, or @code{#f}
1012 if it has none.
1013 @end deffn
1014
1015 @deffn {Scheme Procedure} record-type-uid rtd
1016 Returns the uid of the record-type descriptor @var{rtd}, or @code{#f} if
1017 it has none.
1018 @end deffn
1019
1020 @deffn {Scheme Procedure} record-type-generative? rtd
1021 Returns @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
1026 Returns @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
1031 Returns @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
1036 Returns a vector of symbols giving the names of the fields defined by
1037 the record-type descriptor @var{rtd} (and not any of its sub- or
1038 supertypes).
1039 @end deffn
1040
1041 @deffn {Scheme Procedure} record-field-mutable? rtd k
1042 Returns @code{#t} if the field at index @var{k} of the record-type
1043 descriptor @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
1049 The @code{(rnrs exceptions (6))} library provides functionality related
1050 to signaling and handling exceptional situations. This functionality is
1051 similar to the exception handling systems provided by Guile's core
1052 library @xref{Exceptions}, and by the SRFI-18 and SRFI-34
1053 modules---@xref{SRFI-18 Exceptions}, and @ref{SRFI-34},
1054 respectively---but there are some key differences in concepts and
1055 behavior.
1056
1057 A raised exception may be @dfn{continuable} or @dfn{non-continuable}.
1058 When an exception is raised non-continuably, another exception, with the
1059 condition type @code{&non-continuable}, will be raised when the
1060 exception handler returns locally. Raising an exception continuably
1061 captures the current continuation and invokes it after a local return
1062 from the exception handler.
1063
1064 Like SRFI-18 and SRFI-34, R6RS exceptions are implemented on top of
1065 Guile's native @code{throw} and @code{catch} forms, and use custom
1066 ``throw keys'' to identify their exception types. As a consequence,
1067 Guile's @code{catch} form can handle exceptions thrown by these APIs,
1068 but the reverse is not true: Handlers registered by the
1069 @code{with-exception-handler} procedure described below will only be
1070 called on exceptions thrown by the corresponding @code{raise} procedure.
1071
1072 @deffn {Scheme Procedure} with-exception-handler handler thunk
1073 Installs @var{handler}, which must be a procedure taking one argument,
1074 as the current exception handler during the invokation of @var{thunk}, a
1075 procedure taking zero arguments. The handler in place at the time
1076 @code{with-exception-handler} is called is made current again once
1077 either @var{thunk} returns or @var{handler} is invoked after an
1078 exception is thrown from within @var{thunk}.
1079
1080 This procedure is similar to the @code{with-throw-handler} procedure
1081 provided by Guile's code library; (@pxref{Throw Handlers}).
1082 @end deffn
1083
1084 @deffn {Scheme Syntax} guard (variable clause1 clause2 ...) body
1085 Evaluates the expression given by @var{body}, first creating an ad hoc
1086 exception handler that binds a raised exception to @var{variable} and
1087 then evaluates the specified @var{clause}s as if they were part of a
1088 @code{cond} expression, with the value of the first matching clause
1089 becoming the value of the @code{guard} expression
1090 (@pxref{if cond case}). If none of the clause's test expressions
1091 evaluates to @code{#t}, the exception is re-raised, with the exception
1092 handler that was current before the evaluation of the @code{guard} form.
1093
1094 For example, the expression
1095
1096 @lisp
1097 (guard (ex ((eq? ex 'foo) 'bar) ((eq? ex 'bar) 'baz))
1098 (raise 'bar))
1099 @end lisp
1100
1101 evaluates to @code{baz}.
1102 @end deffn
1103
1104 @deffn {Scheme Procedure} raise obj
1105 Raises a non-continuable exception by invoking the currently-installed
1106 exception handler on @var{obj}. If the handler returns, a
1107 @code{&non-continuable} exception will be raised in the dynamic context
1108 in which the handler was installed.
1109 @end deffn
1110
1111 @deffn {Scheme Procedure} raise-continuable obj
1112 Raises a continuable exception by invoking currently-installed exception
1113 handler on @var{obj}.
1114 @end deffn
1115
1116 @node rnrs conditions
1117 @subsubsection rnrs conditions
1118
1119 The @code{(rnrs condition (6))} library provides forms and procedures
1120 for constructing new condition types, as well as a library of
1121 pre-defined condition types that represent a variety of common
1122 exceptional 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
1126 Conditions may be manipulated singly, as @dfn{simple conditions}, or
1127 when composed with other conditions to form @dfn{compound conditions}.
1128 Compound conditions do not ``nest''---constructing a new compound
1129 condition out of existing compound conditions will ``flatten'' them
1130 into their component simple conditions. For example, making a new
1131 condition out of a @code{&message} condition and a compound condition
1132 that contains an @code{&assertion} condition and another @code{&message}
1133 condition will produce a compound condition that contains two
1134 @code{&message} conditions and one @code{&assertion} condition.
1135
1136 The record type predicates and field accessors described below can
1137 operate on either simple or compound conditions. In the latter case,
1138 the predicate returns @code{#t} if the compound condition contains a
1139 component simple condition of the appropriate type; the field accessors
1140 return the requisite fields from the first component simple condition
1141 found to be of the appropriate type.
1142
1143 This 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
1146 around condition field accessors, and comes with a larger number of
1147 pre-defined condition types. The two APIs are not currently compatible,
1148 however; the @code{condition?} predicate from one API will return
1149 @code{#f} when applied to a condition object created in the other.
1150
1151 @deffn {Condition Type} &condition
1152 @deffnx {Scheme Procedure} condition? obj
1153 The base record type for conditions.
1154 @end deffn
1155
1156 @deffn {Scheme Procedure} condition condition1 ...
1157 @deffnx {Scheme Procedure} simple-conditions condition
1158 The @code{condition} procedure creates a new compound condition out of
1159 its condition arguments, flattening any specified compound conditions
1160 into their component simple conditions as described above.
1161
1162 @code{simple-conditions} returns a list of the component simple
1163 conditions of the compound condition @code{condition}, in the order in
1164 which 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
1169 These procedures return condition predicate and accessor procedures for
1170 the specified condition record type @var{rtd}.
1171 @end deffn
1172
1173 @deffn {Scheme Syntax} define-condition-type condition-type supertype constructor predicate field-spec ...
1174 Evaluates to a new record type definition for a condition type with the
1175 name @var{condition-type} that has the condition type @var{supertype} as
1176 its parent. A default constructor, which binds its arguments to the
1177 fields of this type and its parent types, will be bound to the
1178 identifier @var{constructor}; a condition predicate will be bound to
1179 @var{predicate}. The fields of the new type, which are immutable, are
1180 specified by the @var{field-spec}s, each of which must be of the form:
1181 @lisp
1182 (field accessor)
1183 @end lisp
1184 where @var{field} gives the name of the field and @var{accessor} gives
1185 the name for a binding to an accessor procedure created for this field.
1186 @end deffn
1187
1188 @deffn {Condition Type} &message
1189 @deffnx {Scheme Procedure} make-message-condition message
1190 @deffnx {Scheme Procedure} message-condition? obj
1191 @deffnx {Scheme Procedure} condition-message condition
1192 A type that includes a message describing the condition that occurred.
1193 @end deffn
1194
1195 @deffn {Condition Type} &warning
1196 @deffnx {Scheme Procedure} make-warning
1197 @deffnx {Scheme Procedure} warning? obj
1198 A base type for representing non-fatal conditions during execution.
1199 @end deffn
1200
1201 @deffn {Condition Type} &serious
1202 @deffnx {Scheme Procedure} make-serious-condition
1203 @deffnx {Scheme Procedure} serious-condition? obj
1204 A base type for conditions representing errors serious enough that
1205 cannot be ignored.
1206 @end deffn
1207
1208 @deffn {Condition Type} &error
1209 @deffnx {Scheme Procedure} make-error
1210 @deffnx {Scheme Procedure} error? obj
1211 A base type for conditions representing errors.
1212 @end deffn
1213
1214 @deffn {Condition Type} &violation
1215 @deffnx {Scheme Procedure} make-violation
1216 @deffnx {Scheme Procedure} violation?
1217 A subtype of @code{&serious} that can be used to represent violations
1218 of a language or library standard.
1219 @end deffn
1220
1221 @deffn {Condition Type} &assertion
1222 @deffnx {Scheme Procedure} make-assertion-violation
1223 @deffnx {Scheme Procedure} assertion-violation? obj
1224 A subtype of @code{&violation} that indicates an invalid call to a
1225 procedure.
1226 @end deffn
1227
1228 @deffn {Condition Type} &irritants
1229 @deffnx {Scheme Procedure} make-irritants-condition irritants
1230 @deffnx {Scheme Procedure} irritants-condition? obj
1231 @deffnx {Scheme Procedure} condition-irritants condition
1232 A base type used for storing information about the causes of another
1233 condition in a compound condition.
1234 @end deffn
1235
1236 @deffn {Condition Type} &who
1237 @deffnx {Scheme Procedure} make-who-condition who
1238 @deffnx {Scheme Procedure} who-condition? obj
1239 @deffnx {Scheme Procedure} condiction-who condition
1240 A base type used for storing the identity, a string or symbol, of the
1241 entity responsible for another condition in a compound condition.
1242 @end deffn
1243
1244 @deffn {Condition Type} &non-continuable
1245 @deffnx {Scheme Procedure} make-non-continuable-violation
1246 @deffnx {Scheme Procedure} non-continuable-violation? obj
1247 A subtype of @code{&violation} used to indicate that an exception
1248 handler invoked by @code{raise} has returned locally.
1249 @end deffn
1250
1251 @deffn {Condition Type} &implementation-restriction
1252 @deffnx {Scheme Procedure} make-implementation-restriction-violation
1253 @deffnx {Scheme Procedure} implementation-restriction-violation? obj
1254 A subtype of @code{&violation} used to indicate a violation of an
1255 implementation restriction.
1256 @end deffn
1257
1258 @deffn {Condition Type} &lexical
1259 @deffnx {Scheme Procedure} make-lexical-violation
1260 @deffnx {Scheme Procedure} lexical-violation? obj
1261 A subtype of @code{&violation} used to indicate a syntax violation at
1262 the level of the datum syntax.
1263 @end deffn
1264
1265 @deffn {Condition Type} &syntax
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
1270 A subtype of @code{&violation} that indicates a syntax violation. The
1271 @var{form} and @var{subform} fields, which must be datum values,
1272 indicate the syntactic form responsible for the condition.
1273 @end deffn
1274
1275 @deffn {Condition Type} &undefined
1276 @deffnx {Scheme Procedure} make-undefined-violation
1277 @deffnx {Scheme Procedure} undefined-violation? obj
1278 A subtype of @code{&violation} that indicates a reference to an unbound
1279 identifier.
1280 @end deffn
1281
1282 @node I/O Conditions
1283 @subsubsection I/O Conditions
1284
1285 These condition types are exported by both the
1286 @code{(rnrs io ports (6))} and @code{(rnrs io simple (6))} libraries.
1287
1288 @deffn {Condition Type} &i/o
1289 @deffnx {Scheme Procedure} make-i/o-error
1290 @deffnx {Scheme Procedure} i/o-error? obj
1291 A condition supertype for more specific I/O errors.
1292 @end deffn
1293
1294 @deffn {Condition Type} &i/o-read
1295 @deffnx {Scheme Procedure} make-i/o-read-error
1296 @deffnx {Scheme Procedure} i/o-read-error? obj
1297 A subtype of @code{&i/o}; represents read-related I/O errors.
1298 @end deffn
1299
1300 @deffn {Condition Type} &i/o-write
1301 @deffnx {Scheme Procedure} make-i/o-write-error
1302 @deffnx {Scheme Procedure} i/o-write-error? obj
1303 A subtype of @code{&i/o}; represents write-related I/O errors.
1304 @end deffn
1305
1306 @deffn {Condition Type} &i/o-invalid-position
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
1310 A subtype of @code{&i/o}; represents an error related to an attempt to
1311 set the file position to an invalid position.
1312 @end deffn
1313
1314 @deffn {Condition Type} &i/o-filename
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
1318 A subtype of @code{&i/o}; represents an error related to an operation on
1319 a named file.
1320 @end deffn
1321
1322 @deffn {Condition Type} &i/o-file-protection
1323 @deffnx {Scheme Procedure} make-i/o-file-protection-error filename
1324 @deffnx {Scheme Procedure} i/o-file-protection-error? obj
1325 A subtype of @code{&i/o-filename}; represents an error resulting from an
1326 attempt to access a named file for which the caller had insufficient
1327 permissions.
1328 @end deffn
1329
1330 @deffn {Condition Type} &i/o-file-is-read-only
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
1333 A subtype of @code{&i/o-file-protection}; represents an error related to
1334 an attempt to write to a read-only file.
1335 @end deffn
1336
1337 @deffn {Condition Type} &i/o-file-already-exists
1338 @deffnx {Scheme Procedure} make-i/o-file-already-exists-error filename
1339 @deffnx {Scheme Procedure} i/o-file-already-exists-error? obj
1340 A subtype of @code{&i/o-filename}; represents an error related to an
1341 operation on an existing file that was assumed not to exist.
1342 @end deffn
1343
1344 @deffn {Condition Type} &i/o-file-does-not-exist
1345 @deffnx {Scheme Procedure} make-i/o-file-does-not-exist-error
1346 @deffnx {Scheme Procedure} i/o-file-does-not-exist-error? obj
1347 A subtype of @code{&i/o-filename}; represents an error related to an
1348 operation on a non-existent file that was assumed to exist.
1349 @end deffn
1350
1351 @deffn {Condition Type} &i/o-port
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
1355 A subtype of @code{&i/o}; represents an error related to an operation on
1356 the port @var{port}.
1357 @end deffn
1358
1359 @node rnrs io ports
1360 @subsubsection rnrs io ports
1361
1362 The @code{(rnrs io ports (6))} library provides various procedures and
1363 syntactic forms for use in writing to and reading from ports. This
1364 functionality 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
1370 The @code{(rnrs io simple (6))} library provides convenience functions
1371 for performing textual I/O on ports. This library also exports all of
1372 the 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
1377 These procedures are identical to the ones provided by the
1378 @code{(rnrs io ports (6))} library. @xref{R6RS I/O Ports}, for
1379 documentation.
1380 @end deffn
1381
1382 @deffn {Scheme Procedure} input-port? obj
1383 @deffnx {Scheme Procedure} output-port? obj
1384 These procedures are identical to the ones provided by Guile's core
1385 library. @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
1394 These procedures are identical to the ones provided by Guile's core
1395 library. @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
1400 These procedures are identical to the ones provided by Guile's core
1401 library. @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
1408 These procedures are identical to the ones provided by Guile's core
1409 library. @xref{Reading}, for documentation.
1410 @end deffn
1411
1412 @deffn {Scheme Procedure} read
1413 @deffnx {Scheme Procedure} read textual-input-port
1414 This 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
1426 These procedures are identical to the ones provided by Guile's core
1427 library. @xref{Writing}, for documentation.
1428 @end deffn
1429
1430 @node rnrs files
1431 @subsubsection rnrs files
1432
1433 The @code{(rnrs files (6))} library provides the @code{file-exists?} and
1434 @code{delete-file} procedures, which test for the existence of a file
1435 and allow the deletion of files from the filesystem, respectively.
1436
1437 These procedures are identical to the ones provided by Guile's core
1438 library. @xref{File System}, for documentation.
1439
1440 @node rnrs programs
1441 @subsubsection rnrs programs
1442
1443 The @code{(rnrs programs (6))} library provides procedures for
1444 process management and introspection.
1445
1446 @deffn {Scheme Procedure} command-line
1447 This 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
1453 This 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
1459 The @code{(rnrs arithmetic fixnums (6))} library provides procedures for
1460 performing arithmetic operations on an implementation-dependent range of
1461 exact integer values, which R6RS refers to as @dfn{fixnums}. In Guile,
1462 the size of a fixnum is determined by the size of the @code{SCM} type; a
1463 single SCM struct is guaranteed to be able to hold an entire fixnum,
1464 making fixnum computations particularly
1465 efficient---(@pxref{The SCM Type}). On 32-bit systems, the most
1466 negative and most positive fixnum values are, respectively, -536870912
1467 and 536870911.
1468
1469 Unless otherwise specified, all of the procedures below take fixnums as
1470 arguments, and will raise an @code{&assertion} condition if passed a
1471 non-fixnum argument or an @code{&implementation-restriction} condition
1472 if their result is not itself a fixnum.
1473
1474 @deffn {Scheme Procedure} fixnum? obj
1475 Returns @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
1481 These procedures return, respectively, the maximum number of bits
1482 necessary to represent a fixnum value in Guile, the minimum fixnum
1483 value, 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 ...
1491 These procedures return @code{#t} if their fixnum arguments are
1492 (respectively): equal, monotonically increasing, monotonically
1493 decreasing, 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
1502 These numerical predicates return @code{#t} if @var{fx} is,
1503 respectively, 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 ...
1509 These 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
1514 These 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
1519 Returns the difference of @var{fx1} and @var{fx2}, or the negation of
1520 @var{fx}, if called with a single argument.
1521
1522 An @code{&assertion} condition is raised if the result is not itself a
1523 fixnum.
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
1532 These procedures implement number-theoretic division on fixnums;
1533 @xref{(rnrs base)}, for a description of their semantics.
1534 @end deffn
1535
1536 @deffn {Scheme Procedure} fx+/carry fx1 fx2 fx3
1537 Returns 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
1547 Returns 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
1558 Returns 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 ...
1570 These procedures are identical to the @code{lognot}, @code{logand},
1571 @code{logior}, and @code{logxor} procedures provided by Guile's core
1572 library. @xref{Bitwise Operations}, for documentation.
1573 @end deffn
1574
1575 @deffn {Scheme Procedure} fxif fx1 fx2 fx3
1576 Returns 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}
1578 if 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
1583 Returns 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
1588 Returns the number of bits necessary to represent @var{fx}.
1589 @end deffn
1590
1591 @deffn {Scheme Procedure} fxfirst-bit-set fx
1592 Returns the index of the least significant 1 bit in the two's complement
1593 representation of @var{fx}.
1594 @end deffn
1595
1596 @deffn {Scheme Procedure} fxbit-set? fx1 fx2
1597 Returns @code{#t} if the @var{fx2}th bit in the two's complement
1598 representation of @var{fx1} is 1, @code{#f} otherwise.
1599 @end deffn
1600
1601 @deffn {Scheme Procedure} fxcopy-bit fx1 fx2 fx3
1602 Returns 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
1607 Returns the integer representation of the contiguous sequence of bits in
1608 @var{fx1} that starts at position @var{fx2} (inclusive) and ends at
1609 position @var{fx3} (exclusive).
1610 @end deffn
1611
1612 @deffn {Scheme Procedure} fxcopy-bit-field fx1 fx2 fx3 fx4
1613 Returns the result of replacing the bit field in @var{fx1} with start
1614 and end positions @var{fx2} and @var{fx3} with the corresponding bit
1615 field 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
1621 Returns the result of shifting the bits of @var{fx1} right or left by
1622 the @var{fx2} positions. @code{fxarithmetic-shift} is identical
1623 to @code{fxarithmetic-shift-left}.
1624 @end deffn
1625
1626 @deffn {Scheme Procedure} fxrotate-bit-field fx1 fx2 fx3 fx4
1627 Returns the result of cyclically permuting the bit field in @var{fx1}
1628 with start and end positions @var{fx2} and @var{fx3} by @var{fx4} bits
1629 in the direction of more significant bits.
1630 @end deffn
1631
1632 @deffn {Scheme Procedure} fxreverse-bit-field fx1 fx2 fx3
1633 Returns the result of reversing the order of the bits of @var{fx1}
1634 between 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
1641 The @code{(rnrs arithmetic flonums (6))} library provides procedures for
1642 performing arithmetic operations on inexact representations of real
1643 numbers, which R6RS refers to as @dfn{flonums}.
1644
1645 Unless otherwise specified, all of the procedures below take flonums as
1646 arguments, and will raise an @code{&assertion} condition if passed a
1647 non-flonum argument.
1648
1649 @deffn {Scheme Procedure} flonum? obj
1650 Returns @code{#t} if @var{obj} is a flonum, @code{#f} otherwise.
1651 @end deffn
1652
1653 @deffn {Scheme Procedure} real->flonum x
1654 Returns 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 ...
1663 These procedures return @code{#t} if their flonum arguments are
1664 (respectively): equal, monotonically increasing, monotonically
1665 decreasing, 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
1675 These numerical predicates return @code{#t} if @var{fl} is,
1676 respectively, an integer, zero, greater than zero, less than zero, odd,
1677 even, @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
1684 These numerical predicates return @code{#t} if @var{fl} is,
1685 respectively, 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 ...
1690 These 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 ...
1695 These 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
1702 These procedures return, respectively, the difference or quotient of
1703 their arguments when called with two arguments; when called with a
1704 single argument, they return the additive or multiplicative inverse of
1705 @var{fl}.
1706 @end deffn
1707
1708 @deffn {Scheme Procedure} flabs fl
1709 Returns 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
1718 These procedures implement number-theoretic division on flonums;
1719 @xref{(rnrs base)}, for a description for their semantics.
1720 @end deffn
1721
1722 @deffn {Scheme Procedure} flnumerator fl
1723 @deffnx {Scheme Procedure} fldenominator fl
1724 These procedures return the numerator or denominator of @var{fl} as a
1725 flonum.
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
1732 These procedures are identical to the @code{floor}, @code{ceiling},
1733 @code{truncate}, and @code{round} procedures provided by Guile's core
1734 library. @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
1747 These procedures, which compute the usual transcendental functions, are
1748 the 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
1753 Returns 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
1755 is returned.
1756 @end deffn
1757
1758 @deffn {Scheme Procedure} flexpt fl1 fl2
1759 Returns the value of @var{fl1} raised to the power of @var{fl2}.
1760 @end deffn
1761
1762 The following condition types are provided to allow Scheme
1763 implementations that do not support infinities or @code{NaN} values
1764 to indicate that a computation resulted in such a value. Guile supports
1765 both of these, so these conditions will never be raised by Guile's
1766 standard libraries implementation.
1767
1768 @deffn {Condition Type} &no-infinities
1769 @deffnx {Scheme Procedure} make-no-infinities-violation obj
1770 @deffnx {Scheme Procedure} no-infinities-violation?
1771 A condition type indicating that a computation resulted in an infinite
1772 value on a Scheme implementation incapable of representing infinities.
1773 @end deffn
1774
1775 @deffn {Condition Type} &no-nans
1776 @deffnx {Scheme Procedure} make-no-nans-violation obj
1777 @deffnx {Scheme Procedure} no-nans-violation? obj
1778 A condition type indicating that a computation resulted in a @code{NaN}
1779 value on a Scheme implementation incapable of representing @code{NaN}s.
1780 @end deffn
1781
1782 @deffn {Scheme Procedure} fixnum->flonum fx
1783 Returns 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
1789 The @code{(rnrs arithmetic bitwise (6))} library provides procedures for
1790 performing bitwise arithmetic operations on the two's complement
1791 representations of fixnums.
1792
1793 This library and the procedures it exports share functionality with
1794 SRFI-60, which provides support for bitwise manipulation of integers
1795 (@pxref{SRFI-60}).
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 ...
1801 These procedures are identical to the @code{lognot}, @code{logand},
1802 @code{logior}, and @code{logxor} procedures provided by Guile's core
1803 library. @xref{Bitwise Operations}, for documentation.
1804 @end deffn
1805
1806 @deffn {Scheme Procedure} bitwise-if ei1 ei2 ei3
1807 Returns 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}
1809 if 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
1814 Returns 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
1819 Returns the number of bits necessary to represent @var{ei}.
1820 @end deffn
1821
1822 @deffn {Scheme Procedure} bitwise-first-bit-set ei
1823 Returns the index of the least significant 1 bit in the two's complement
1824 representation of @var{ei}.
1825 @end deffn
1826
1827 @deffn {Scheme Procedure} bitwise-bit-set? ei1 ei2
1828 Returns @code{#t} if the @var{ei2}th bit in the two's complement
1829 representation of @var{ei1} is 1, @code{#f} otherwise.
1830 @end deffn
1831
1832 @deffn {Scheme Procedure} bitwise-copy-bit ei1 ei2 ei3
1833 Returns 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
1838 Returns the integer representation of the contiguous sequence of bits in
1839 @var{ei1} that starts at position @var{ei2} (inclusive) and ends at
1840 position @var{ei3} (exclusive).
1841 @end deffn
1842
1843 @deffn {Scheme Procedure} bitwise-copy-bit-field ei1 ei2 ei3 ei4
1844 Returns the result of replacing the bit field in @var{ei1} with start
1845 and end positions @var{ei2} and @var{ei3} with the corresponding bit
1846 field 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
1852 Returns the result of shifting the bits of @var{ei1} right or left by
1853 the @var{ei2} positions. @code{bitwise-arithmetic-shift} is identical
1854 to @code{bitwise-arithmetic-shift-left}.
1855 @end deffn
1856
1857 @deffn {Scheme Procedure} bitwise-rotate-bit-field ei1 ei2 ei3 ei4
1858 Returns the result of cyclically permuting the bit field in @var{ei1}
1859 with start and end positions @var{ei2} and @var{ei3} by @var{ei4} bits
1860 in the direction of more significant bits.
1861 @end deffn
1862
1863 @deffn {Scheme Procedure} bitwise-reverse-bit-field ei1 ei2 ei3
1864 Returns the result of reversing the order of the bits of @var{e1}
1865 between 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
1872 The @code{(rnrs syntax-case (6))} library provides access to the
1873 @code{syntax-case} system for writing hygienic macros. With one
1874 exception, all of the forms and procedures exported by this library
1875 are ``re-exports'' of Guile's native support for @code{syntax-case};
1876 @xref{Syntax Case}, for documentation, examples, and rationale.
1877
1878 @deffn {Scheme Procedure} make-variable-transformer proc
1879 Creates a new variable transformer out of @var{proc}, a procedure that
1880 takes a syntax object as input and returns a syntax object. If an
1881 identifier to which the result of this procedure is bound appears on the
1882 left-hand side of a @code{set!} expression, @var{proc} will be called
1883 with a syntax object representing the entire @code{set!} expression,
1884 and its return value will replace that @code{set!} expression.
1885 @end deffn
1886
1887 @deffn {Scheme Syntax} syntax-case expression (literal ...) clause ...
1888 The @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
1895 These forms allow references to be made in the body of a syntax-case
1896 output expression subform to datum and non-datum values. They are
1897 identical to the forms provided by Guile's core library;
1898 @xref{Syntax Case}, for documentation.
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
1904 These predicate procedures operate on syntax objects representing
1905 Scheme identifiers. @code{identifier?} returns @code{#t} if @var{obj}
1906 represents 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
1909 output, or vice-versa. @code{free-identifier=?} returns @code{#t} if
1910 and only @var{id1} and @var{id2} would refer to the same binding in the
1911 output of the transformer, independent of any bindings introduced by the
1912 transformer.
1913 @end deffn
1914
1915 @deffn {Scheme Procedure} generate-temporaries l
1916 Returns a list, of the same length as @var{l}, which must be a list or
1917 a 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
1922 These procedures convert wrapped syntax objects to and from Scheme datum
1923 values. The syntax object returned by @code{datum->syntax} shares
1924 contextual 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
1929 Constructs a new compound condition that includes the following
1930 simple conditions:
1931 @itemize @bullet
1932 @item
1933 If @var{whom} is not @code{#f}, a @code{&who} condition with the
1934 @var{whom} as its field
1935 @item
1936 A @code{&message} condition with the specified @var{message}
1937 @item
1938 A @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
1946 The @code{(rnrs hashtables (6))} library provides structures and
1947 procedures for creating and accessing hash tables. The hash tables API
1948 defined by R6RS is substantially similar to both Guile's native hash
1949 tables implementation as well as the one provided by SRFI-69;
1950 @xref{Hash Tables}, and @ref{SRFI-69}, respectively. Note that you can
1951 write portable R6RS library code that manipulates SRFI-69 hash tables
1952 (by importing the @code{(srfi :69)} library); however, hash tables
1953 created by one API cannot be used by another.
1954
1955 Like SRFI-69 hash tables---and unlike Guile's native ones---R6RS hash
1956 tables associate hash and equality functions with a hash table at the
1957 time of its creation. Additionally, R6RS allows for the creation
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
1962 Returns a new hash table that uses @code{eq?} to compare keys and
1963 Guile's @code{hashq} procedure as a hash function. If @var{k} is given,
1964 it 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
1969 Returns a new hash table that uses @code{eqv?} to compare keys and
1970 Guile's @code{hashv} procedure as a hash function. If @var{k} is given,
1971 it 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
1976 Returns 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
1978 that accepts two arguments and returns a true value if they are
1979 equivalent, @code{#f} otherwise; @var{hash-function} must be a procedure
1980 that accepts one argument and returns a non-negative integer.
1981
1982 If @var{k} is given, it specifies the initial capacity of the hash
1983 table.
1984 @end deffn
1985
1986 @deffn {Scheme Procedure} hashtable? obj
1987 Returns @code{#t} if @var{obj} is an R6RS hash table, @code{#f}
1988 otherwise.
1989 @end deffn
1990
1991 @deffn {Scheme Procedure} hashtable-size hashtable
1992 Returns the number of keys currently in the hash table @var{hashtable}.
1993 @end deffn
1994
1995 @deffn {Scheme Procedure} hashtable-ref hashtable key default
1996 Returns 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
2001 Associates the key @var{key} with the value @var{obj} in the hash table
2002 @var{hashtable}, and returns an unspecified value. An @code{&assertion}
2003 condition is raised if @var{hashtable} is immutable.
2004 @end deffn
2005
2006 @deffn {Scheme Procedure} hashtable-delete! hashtable key
2007 Removes any association found for the key @var{key} in the hash table
2008 @var{hashtable}, and returns an unspecified value. An @code{&assertion}
2009 condition is raised if @var{hashtable} is immutable.
2010 @end deffn
2011
2012 @deffn {Scheme Procedure} hashtable-contains? hashtable key
2013 Returns @code{#t} if the hash table @var{hashtable} contains an
2014 association for the key @var{key}, @code{#f} otherwise.
2015 @end deffn
2016
2017 @deffn {Scheme Procedure} hashtable-update! hashtable key proc default
2018 Associates with @var{key} in the hash table @var{hashtable} the result
2019 of calling @var{proc}, which must be a procedure that takes one
2020 argument, on the value currently associated @var{key} in
2021 @var{hashtable}---or on @var{default} if no such association exists.
2022 An @code{&assertion} condition is raised if @var{hashtable} is
2023 immutable.
2024 @end deffn
2025
2026 @deffn {Scheme Procedure} hashtable-copy hashtable
2027 @deffnx {Scheme Procedure} hashtable-copy hashtable mutable
2028 Returns a copy of the hash table @var{hashtable}. If the optional
2029 argument @var{mutable} is a true value, the new hash table will be
2030 immutable.
2031 @end deffn
2032
2033 @deffn {Scheme Procedure} hashtable-clear! hashtable
2034 @deffnx {Scheme Procedure} hashtable-clear! hashtable k
2035 Removes all of the associations from the hash table @var{hashtable}.
2036 The optional argument @var{k}, which specifies a new capacity for the
2037 hash table, is accepted by Guile's @code{(rnrs hashtables)}
2038 implementation, but is ignored.
2039 @end deffn
2040
2041 @deffn {Scheme Procedure} hashtable-keys hashtable
2042 Returns 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
2047 Return two values---a vector of the keys with associations in the hash
2048 table @var{hashtable}, and a vector of the values to which these keys
2049 are mapped, in corresponding but unspecified order.
2050 @end deffn
2051
2052 @deffn {Scheme Procedure} hashtable-equivalence-function hashtable
2053 Returns the equivalence predicated use by @var{hashtable}. This
2054 procedure returns @code{eq?} and @code{eqv?}, respectively, for hash
2055 tables created by @code{make-eq-hashtable} and
2056 @code{make-eqv-hashtable}.
2057 @end deffn
2058
2059 @deffn {Scheme Procedure} hashtable-hash-function hashtable
2060 Returns the hash function used by @var{hashtable}. For hash tables
2061 created 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
2066 Returns @code{#t} if @var{hashtable} is mutable, @code{#f} otherwise.
2067 @end deffn
2068
2069 A number of hash functions are provided for convenience:
2070
2071 @deffn {Scheme Procedure} equal-hash obj
2072 Returns an integer hash value for @var{obj}, based on its structure and
2073 current 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
2079 These procedures are identical to the ones provided by Guile's core
2080 library. @xref{Hash Table Reference}, for documentation.
2081 @end deffn
2082
2083 @deffn {Scheme Procedure} string-ci-hash string
2084 Returns an integer hash value for @var{string} based on its contents,
2085 ignoring 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
2092 The @code{(rnrs enums (6))} library provides structures and procedures
2093 for working with enumerable sets of symbols. Guile's implementation
2094 defines an @dfn{enum-set} record type that encapsulates a finite set of
2095 distinct symbols, the @dfn{universe}, and a subset of these symbols,
2096 which define the enumeration set.
2097
2098 The SRFI-1 list library provides a number of procedures for performing
2099 set operations on lists; Guile's @code{(rnrs enums)} implementation
2100 makes use of several of them. @xref{SRFI-1 Set Operations}, for
2101 more information.
2102
2103 @deffn {Scheme Procedure} make-enumeration symbol-list
2104 Returns a new enum-set whose universe and enumeration set are both equal
2105 to @var{symbol-list}, a list of symbols.
2106 @end deffn
2107
2108 @deffn {Scheme Procedure} enum-set-universe enum-set
2109 Returns an enum-set representing the universe of @var{enum-set},
2110 an enum-set.
2111 @end deffn
2112
2113 @deffn {Scheme Procedure} enum-set-indexer enum-set
2114 Returns a procedure that takes a single argument and returns the
2115 zero-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
2117 universe.
2118 @end deffn
2119
2120 @deffn {Scheme Procedure} enum-set-constructor enum-set
2121 Returns a procedure that takes a single argument, a list of symbols
2122 from the universe of @var{enum-set}, an enum-set, and returns a new
2123 enum-set with the same universe that represents a subset containing the
2124 specified symbols.
2125 @end deffn
2126
2127 @deffn {Scheme Procedure} enum-set->list enum-set
2128 Returns 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
2130 universe 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
2136 These procedures test for membership of symbols and enum-sets in other
2137 enum-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
2141 every 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
2143 subset, as per @code{enum-set-subset?} of @var{enum-set2} and vice
2144 versa.
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
2150 These procedures return, respectively, the union, intersection, and
2151 difference of their enum-set arguments.
2152 @end deffn
2153
2154 @deffn {Scheme Procedure} enum-set-complement enum-set
2155 Returns @var{enum-set}'s complement (an enum-set), with regard to its
2156 universe.
2157 @end deffn
2158
2159 @deffn {Scheme Procedure} enum-set-projection enum-set1 enum-set2
2160 Returns the projection of the enum-set @var{enum-set1} onto the universe
2161 of the enum-set @var{enum-set2}.
2162 @end deffn
2163
2164 @deffn {Scheme Syntax} define-enumeration type-name (symbol ...) constructor-syntax
2165 Evaluates to two new definitions: A constructor bound to
2166 @var{constructor-syntax} that behaves similarly to constructors created
2167 by @code{enum-set-constructor}, above, and creates new @var{enum-set}s
2168 in the universe specified by @code{(symbol ...)}; and a ``predicate
2169 macro'' bound to @var{type-name}, which has the following form:
2170
2171 @lisp
2172 (@var{type-name} sym)
2173 @end lisp
2174
2175 If @var{sym} is a member of the universe specified by the @var{symbol}s
2176 above, this form evaluates to @var{sym}. Otherwise, a @code{&syntax}
2177 condition is raised.
2178 @end deffn
2179
2180 @node rnrs
2181 @subsubsection rnrs
2182
2183 The @code{(rnrs (6))} library is a composite of all of the other R6RS
2184 standard libraries---it imports and re-exports all of their exported
2185 procedures and syntactic forms---with the exception of the following
2186 libraries:
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
2198 The @code{(rnrs eval (6)} library provides procedures for performing
2199 ``on-the-fly'' evaluation of expressions.
2200
2201 @deffn {Scheme Procedure} eval expression environment
2202 Evaluates @var{expression}, which must be a datum representation of a
2203 valid Scheme expression, in the environment specified by
2204 @var{environment}. This procedure is identical to the one provided by
2205 Guile's code library; @xref{Fly Evaluation}, for documentation.
2206 @end deffn
2207
2208 @deffn {Scheme Procedure} environment import-spec ...
2209 Constructs and returns a new environment based on the specified
2210 @var{import-spec}s, which must be datum representations of the import
2211 specifications used with the @code{import} form. @xref{R6RS Libraries},
2212 for documentation.
2213 @end deffn
2214
2215 @node rnrs mutable-pairs
2216 @subsubsection rnrs mutable-pairs
2217
2218 The @code{(rnrs mutable-pairs (6))} library provides the @code{set-car!}
2219 and @code{set-cdr!} procedures, which allow the @code{car} and
2220 @code{cdr} fields of a pair to be modified.
2221
2222 These procedures are identical to the ones provide by Guile's core
2223 library. @xref{Pairs}, for documentation. All pairs in Guile are
2224 mutable; consequently, these procedures will never throw the
2225 @code{&assertion} condition described in the R6RS libraries
2226 specification.
2227
2228 @node rnrs mutable-strings
2229 @subsubsection rnrs mutable-strings
2230
2231 The @code{(rnrs mutable-strings (6))} library provides the
2232 @code{string-set!} and @code{string-fill!} procedures, which allow the
2233 content of strings to be modified ``in-place.''
2234
2235 These procedures are identical to the ones provided by Guile's core
2236 library. @xref{String Modification}, for documentation. All strings in
2237 Guile are mutable; consequently, these procedures will never throw the
2238 @code{&assertion} condition described in the R6RS libraries
2239 specification.
2240
2241 @node rnrs r5rs
2242 @subsubsection rnrs r5rs
2243
2244 The @code{(rnrs r5rs (6))} library exports bindings for some procedures
2245 present 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
2249 These procedures are identical to the ones provided by Guile's core
2250 library. @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
2256 These procedures are identical to the ones provided by Guile's core
2257 library. @xref{Integer Operations}, for documentation.
2258 @end deffn
2259
2260 @deffn {Scheme Syntax} delay expr
2261 @deffnx {Scheme Procedure} force promise
2262 The @code{delay} form and the @code{force} procedure are identical to
2263 their counterparts in Guile's core library. @xref{Delayed Evaluation},
2264 for documentation.
2265 @end deffn
2266
2267 @deffn {Scheme Procedure} null-environment n
2268 @deffnx {Scheme Procedure} scheme-report-environment n
2269 These procedures are identical to the ones provided by the
2270 @code{(ice-9 r5rs)} Guile module. @xref{Environments}, for
2271 documentation.
2272 @end deffn
2273
2274 @c r6rs.texi ends here
2275
2276 @c Local Variables:
2277 @c TeX-master: "guile.texi"
2278 @c End: