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