* match.scm: New file.
[bpt/guile.git] / ice-9 / safe-r5rs.scm
1 ;;;; Copyright (C) 2000 Free Software Foundation, Inc.
2 ;;;;
3 ;;;; This program is free software; you can redistribute it and/or modify
4 ;;;; it under the terms of the GNU General Public License as published by
5 ;;;; the Free Software Foundation; either version 2, or (at your option)
6 ;;;; any later version.
7 ;;;;
8 ;;;; This program is distributed in the hope that it will be useful,
9 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ;;;; GNU General Public License for more details.
12 ;;;;
13 ;;;; You should have received a copy of the GNU General Public License
14 ;;;; along with this software; see the file COPYING. If not, write to
15 ;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
16 ;;;; Boston, MA 02111-1307 USA
17 ;;;;
18 \f
19 ;;;; Safe subset of R5RS bindings
20
21 (define-module (ice-9 safe-r5rs))
22
23 (define null-interface (resolve-interface '(ice-9 null)))
24
25 (module-use! %module-public-interface null-interface)
26
27 (export eqv? eq? equal?
28 number? complex? real? rational? integer?
29 exact? inexact?
30 = < > <= >=
31 zero? positive? negative? odd? even?
32 max min
33 + * - /
34 abs
35 quotient remainder modulo
36 gcd lcm
37 numerator denominator
38 floor ceiling truncate round
39 rationalize
40 exp log sin cos tan asin acos atan
41 sqrt
42 expt
43 make-rectangualr make-polar real-part imag-part magnitude angle
44 exact->inexact inexact->exact
45
46 number->string string->number
47
48 boolean?
49 not
50
51 pair?
52 cons car cdr
53 set-car! set-cdr!
54 caar cadr cdar cddr
55 caaar caadr cadar caddr cdaar cdadr cddar cdddr
56 caaaar caaadr caadar caaddr cadaar cadadr caddar cadddr
57 cdaaar cdaadr cdadar cdaddr cddaar cddadr cdddar cddddr
58 null?
59 list?
60 length
61 append
62 reverse
63 list-tail list-ref
64 memq memv member
65 assq assv assoc
66
67 symbol?
68 symbol->string string->symbol
69
70 char?
71 char=? char<? char>? char<=? char>=?
72 char-ci=? char-ci<? char-ci>? char-ci<=? char-ci>=?
73 char-alphabetic? char-numeric? char-whitespace?
74 char-upper-case? char-lower-case?
75 char->integer integer->char
76 char-upcase
77 char-downcase
78
79 string?
80 make-string
81 string
82 string-length
83 string-ref string-set!
84 string=? string-ci=?
85 string<? string>? string<=? string>=?
86 string-ci<? string-ci>? string-ci<=? string-ci>=?
87 substring
88 string-length
89 string-append
90 string->list list->string
91 string-copy string-fill!
92
93 vector?
94 make-vector
95 vector
96 vector-length
97 vector-ref vector-set!
98 vector->list list->vector
99 vector-fill!
100
101 procedure?
102 apply
103 map
104 for-each
105 force
106
107 call-with-current-continuation
108
109 values
110 call-with-values
111 dynamic-wind
112
113 eval
114 null-environment
115
116 input-port? output-port?
117 current-input-port current-output-port
118
119 read
120 read-char
121 peek-char
122 eof-object?
123 char-ready?
124
125 write
126 display
127 newline
128 write-char
129
130 ;;transcript-on
131 ;;transcript-off
132 )
133
134 (define (null-environment n)
135 (if (not (= n 5))
136 (scm-error 'misc-error 'null-environment
137 "~A is not a valid version"
138 (list n)
139 '()))
140 ;; Note that we need to create a *fresh* interface
141 (let ((interface (make-module 31)))
142 (set-module-kind! interface 'interface)
143 (module-use! interface null-interface)
144 interface))