1 ;;; rnrs.scm --- The R6RS composite library
3 ;; Copyright (C) 2010, 2011 Free Software Foundation, Inc.
5 ;; This library is free software; you can redistribute it and/or
6 ;; modify it under the terms of the GNU Lesser General Public
7 ;; License as published by the Free Software Foundation; either
8 ;; version 3 of the License, or (at your option) any later version.
10 ;; This library is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ;; Lesser General Public License for more details.
15 ;; You should have received a copy of the GNU Lesser General Public
16 ;; License along with this library; if not, write to the Free Software
17 ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 (export ;; (rnrs arithmetic bitwise)
23 bitwise-not bitwise-and bitwise-ior bitwise-xor bitwise-if
24 bitwise-bit-count bitwise-length bitwise-first-bit-set
25 bitwise-bit-set? bitwise-copy-bit bitwise-bit-field
26 bitwise-copy-bit-field bitwise-arithmetic-shift
27 bitwise-arithmetic-shift-left bitwise-arithmetic-shift-right
28 bitwise-rotate-bit-field bitwise-reverse-bit-field
30 ;; (rnrs arithmetic fixnums)
32 fixnum? fixnum-width least-fixnum greatest-fixnum fx=? fx>? fx<? fx>=?
33 fx<=? fxzero? fxpositive? fxnegative? fxodd? fxeven? fxmax fxmin fx+
34 fx* fx- fxdiv-and-mod fxdiv fxmod fxdiv0-and-mod0 fxdiv0 fxmod0
35 fx+/carry fx-/carry fx*/carry fxnot fxand fxior fxxor fxif fxbit-count
36 fxlength fxfirst-bit-set fxbit-set? fxcopy-bit fxbit-field
37 fxcopy-bit-field fxarithmetic-shift fxarithmetic-shift-left
38 fxarithmetic-shift-right fxrotate-bit-field fxreverse-bit-field
40 ;; (rnrs arithmetic flonums)
42 flonum? real->flonum fl=? fl<? fl<=? fl>? fl>=? flinteger? flzero?
43 flpositive? flnegative? flodd? fleven? flfinite? flinfinite? flnan?
44 flmax flmin fl+ fl* fl- fl/ flabs fldiv-and-mod fldiv flmod
45 fldiv0-and-mod0 fldiv0 flmod0 flnumerator fldenominator flfloor
46 flceiling fltruncate flround flexp fllog flsin flcos fltan flacos
47 flasin flatan flsqrt flexpt &no-infinities
48 make-no-infinities-violation no-infinities-violation? &no-nans
49 make-no-nans-violation no-nans-violation? fixnum->flonum
53 boolean? symbol? char? vector? null? pair? number? string? procedure?
54 define define-syntax syntax-rules lambda let let* let-values
55 let*-values letrec letrec* begin quote lambda if set! cond case or
56 and not eqv? equal? eq? + - * / max min abs numerator denominator gcd
57 lcm floor ceiling truncate round rationalize real-part imag-part
58 make-rectangular angle div mod div-and-mod div0 mod0 div0-and-mod0
59 expt exact-integer-sqrt sqrt exp log sin cos tan asin acos atan
60 make-polar magnitude angle complex? real? rational? integer? exact?
61 inexact? real-valued? rational-valued? integer-valued? zero?
62 positive? negative? odd? even? nan? finite? infinite? exact inexact =
63 < > <= >= number->string string->number boolean=? cons car cdr caar
64 cadr cdar cddr caaar caadr cadar cdaar caddr cdadr cddar cdddr caaaar
65 caaadr caadar cadaar cdaaar cddaar cdadar cdaadr cadadr caaddr caddar
66 cadddr cdaddr cddadr cdddar cddddr list? list length append reverse
67 list-tail list-ref map for-each symbol->string string->symbol symbol=?
68 char->integer integer->char char=? char<? char>? char<=? char>=?
69 make-string string string-length string-ref string=? string<? string>?
70 string<=? string>=? substring string-append string->list list->string
71 string-for-each string-copy vector? make-vector vector vector-length
72 vector-ref vector-set! vector->list list->vector vector-fill!
73 vector-map vector-for-each error assertion-violation assert
74 call-with-current-continuation call/cc call-with-values dynamic-wind
75 values apply quasiquote unquote unquote-splicing let-syntax
76 letrec-syntax syntax-rules identifier-syntax
80 endianness native-endianness bytevector? make-bytevector
81 bytevector-length bytevector=? bytevector-fill! bytevector-copy!
82 bytevector-copy uniform-array->bytevector bytevector-u8-ref
83 bytevector-s8-ref bytevector-u8-set! bytevector-s8-set!
84 bytevector->u8-list u8-list->bytevector bytevector-uint-ref
85 bytevector-uint-set! bytevector-sint-ref bytevector-sint-set!
86 bytevector->sint-list bytevector->uint-list uint-list->bytevector
87 sint-list->bytevector bytevector-u16-ref bytevector-s16-ref
88 bytevector-u16-set! bytevector-s16-set! bytevector-u16-native-ref
89 bytevector-s16-native-ref bytevector-u16-native-set!
90 bytevector-s16-native-set! bytevector-u32-ref bytevector-s32-ref
91 bytevector-u32-set! bytevector-s32-set! bytevector-u32-native-ref
92 bytevector-s32-native-ref bytevector-u32-native-set!
93 bytevector-s32-native-set! bytevector-u64-ref bytevector-s64-ref
94 bytevector-u64-set! bytevector-s64-set! bytevector-u64-native-ref
95 bytevector-s64-native-ref bytevector-u64-native-set!
96 bytevector-s64-native-set! bytevector-ieee-single-ref
97 bytevector-ieee-single-set! bytevector-ieee-single-native-ref
98 bytevector-ieee-single-native-set! bytevector-ieee-double-ref
99 bytevector-ieee-double-set! bytevector-ieee-double-native-ref
100 bytevector-ieee-double-native-set! string->utf8 string->utf16
101 string->utf32 utf8->string utf16->string utf32->string
105 &condition condition simple-conditions condition? condition-predicate
106 condition-accessor define-condition-type &message
107 make-message-condition message-condition? condition-message &warning
108 make-warning warning? &serious make-serious-condition
109 serious-condition? &error make-error error? &violation make-violation
110 violation? &assertion make-assertion-violation assertion-violation?
111 &irritants make-irritants-condition irritants-condition?
112 condition-irritants &who make-who-condition who-condition?
113 condition-who &non-continuable make-non-continuable-violation
114 non-continuable-violation? &implementation-restriction
115 make-implementation-restriction-violation
116 implementation-restriction-violation? &lexical make-lexical-violation
117 lexical-violation? &syntax make-syntax-violation syntax-violation?
118 syntax-violation-form syntax-violation-subform &undefined
119 make-undefined-violation undefined-violation?
123 when unless do case-lambda
127 make-enumeration enum-set-universe enum-set-indexer
128 enum-set-constructor enum-set->list enum-set-member? enum-set-subset?
129 enum-set=? enum-set-union enum-set-intersection enum-set-difference
130 enum-set-complement enum-set-projection define-enumeration
134 guard with-exception-handler raise raise-continuable
138 file-exists? delete-file &i/o make-i/o-error i/o-error? &i/o-read
139 make-i/o-read-error i/o-read-error? &i/o-write make-i/o-write-error
140 i/o-write-error? &i/o-invalid-position
141 make-i/o-invalid-position-error i/o-invalid-position-error?
142 i/o-error-position &i/o-filename make-i/o-filename-error
143 i/o-filename-error? i/o-error-filename &i/o-file-protection
144 make-i/o-file-protection-error i/o-file-protection-error?
145 &i/o-file-is-read-only make-i/o-file-is-read-only-error
146 i/o-file-is-read-only-error? &i/o-file-already-exists
147 make-i/o-file-already-exists-error i/o-file-already-exists-error?
148 &i/o-file-does-not-exist make-i/o-file-does-not-exist-error
149 i/o-file-does-not-exist-error? &i/o-port make-i/o-port-error
150 i/o-port-error? i/o-error-port
154 make-eq-hashtable make-eqv-hashtable make-hashtable hashtable?
155 hashtable-size hashtable-ref hashtable-set! hashtable-delete!
156 hashtable-contains? hashtable-update! hashtable-copy hashtable-clear!
157 hashtable-keys hashtable-entries hashtable-equivalence-function
158 hashtable-hash-function hashtable-mutable? equal-hash string-hash
159 string-ci-hash symbol-hash
163 file-options buffer-mode buffer-mode?
164 eol-style native-eol-style error-handling-mode
165 make-transcoder transcoder-codec transcoder-eol-style
166 transcoder-error-handling-mode native-transcoder
167 latin-1-codec utf-8-codec utf-16-codec
169 eof-object? port? input-port? output-port? eof-object port-eof?
171 binary-port? textual-port? transcoded-port
172 port-position set-port-position!
173 port-has-port-position? port-has-set-port-position!?
174 close-port call-with-port
175 open-bytevector-input-port make-custom-binary-input-port get-u8
176 lookahead-u8 get-bytevector-n get-bytevector-n! get-bytevector-some
177 get-bytevector-all open-bytevector-output-port
178 make-custom-binary-output-port put-u8 put-bytevector
179 open-string-input-port open-string-output-port
180 call-with-bytevector-output-port
181 call-with-string-output-port
182 latin-1-codec utf-8-codec utf-16-codec
183 open-file-input-port open-file-output-port open-file-input/output-port
184 make-custom-textual-output-port
185 call-with-string-output-port
186 flush-output-port put-string
187 get-char get-datum get-line get-string-all get-string-n get-string-n!
189 put-char put-datum put-string
190 standard-input-port standard-output-port standard-error-port
194 call-with-input-file call-with-output-file current-input-port
195 current-output-port current-error-port with-input-from-file
196 with-output-to-file open-input-file open-output-file close-input-port
197 close-output-port read-char peek-char read write-char newline display
202 find for-all exists filter partition fold-left fold-right remp remove
203 remv remq memp member memv memq assp assoc assv assq cons*
209 ;; (rnrs records inspection)
211 record? record-rtd record-type-name record-type-parent
212 record-type-uid record-type-generative? record-type-sealed?
213 record-type-opaque? record-type-field-names record-field-mutable?
215 ;; (rnrs records procedural)
217 make-record-type-descriptor record-type-descriptor?
218 make-record-constructor-descriptor record-constructor record-predicate
219 record-accessor record-mutator
221 ;; (rnrs records syntactic)
223 define-record-type record-type-descriptor
224 record-constructor-descriptor
228 list-sort vector-sort vector-sort!
230 ;; (rnrs syntax-case)
232 make-variable-transformer syntax
233 ;; Until the deprecated support for a unified modules and
234 ;; bindings namespace is removed, we need to manually resolve
235 ;; a conflict between two bindings: that of the (rnrs
236 ;; syntax-case) module, and the imported `syntax-case'
237 ;; binding. We do so here and below by renaming the macro
239 (rename (syntax-case-hack syntax-case))
240 identifier? bound-identifier=? free-identifier=?
241 syntax->datum datum->syntax generate-temporaries with-syntax
242 quasisyntax unsyntax unsyntax-splicing syntax-violation
246 char-upcase char-downcase char-titlecase char-foldcase
247 char-ci=? char-ci<? char-ci>? char-ci<=? char-ci>=?
248 char-alphabetic? char-numeric? char-whitespace? char-upper-case?
249 char-lower-case? char-title-case? char-general-category
250 string-upcase string-downcase string-titlecase string-foldcase
251 string-ci=? string-ci<? string-ci>? string-ci<=? string-ci>=?
252 string-normalize-nfd string-normalize-nfkd string-normalize-nfc
253 string-normalize-nfkc)
255 (import (rnrs arithmetic bitwise (6))
256 (rnrs arithmetic fixnums (6))
257 (rnrs arithmetic flonums (6))
260 (rnrs bytevectors (6))
262 (rnrs conditions (6))
265 (rnrs exceptions (6))
269 (rnrs hashtables (6))
276 (rnrs records inspection (6))
277 (rnrs records procedural (6))
278 (rnrs records syntactic (6))
280 ;; See note above on exporting syntax-case.
281 (rename (rnrs syntax-case (6))
282 (syntax-case syntax-case-hack))