1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
#| scheme.jl -- foolish attempt to run Scheme code
$Id: scheme.jl,v 1.15 2000/07/31 13:41:16 john Exp $
Copyright (C) 2000 John Harper <john@dcs.warwick.ac.uk>
This file is part of librep.
librep is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
librep is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Jade; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|#
;; the only things really missing from r5rs are macros and multiple
;; values, r4rs should be reasonably okay
;; other warts:
;; (eq? 'FOO 'foo) => #f, guile also fails here
;; `(..) => (backquote ..) not (quasiquote ..)
;; no separate character type
;; reader doesn't handle numbers like: 15#
;; to test this, run the repl, then: ",new test" and ",open scheme"
(define-structure scheme (export
#f #t
;; syntax
quote lambda if set! cond case and or
let let* letrec begin do delay define
;; built-in procedures
not eqv? eq? equal? boolean?
pair? cons car cdr set-car! set-cdr!
caar cadr cdar cddr
caaar caadr cadar caddr
cdaar cdadr cddar cdddr
caaaar caaadr caadar caaddr
cadaar cadadr caddar cadddr
cdaaar cdaadr cdadar cdaddr
cddaar cddadr cdddar cddddr
null? list? list length append reverse
list-tail list-ref memq memv member
assq assv assoc
symbol? symbol->string string->symbol
number? complex? real? rational? integer?
exact? inexact? = < > <= >= zero? positive?
negative? odd? even? max min + * - /
abs quotient remainder modulo gcd lcm
numerator denominator floor ceiling
truncate round rationalize exp log sin cos
tan asin acos atan sqrt expt exact->inexact
inexact->exact string->number number->string
char? char=? char<? char>? char<=? char>=?
char-ci=? char-ci<? char-ci>? char-ci<=?
char-ci>=? char-alphabetic? char-numeric?
char-whitespace? char-upper-case?
char-lower-case? char->integer integer->char
char-upcase char-downcase
string? make-string string string-length
string-ref string-set! string=? string-ci=?
string<? string>? string<=? string>=?
string-ci<? string-ci>? string-ci<=?
string-ci>=? substring string-append
string->list list->string string-copy
string-fill!
vector? make-vector vector vector-length
vector-ref vector-set! vector->list
list->vector vector-fill!
procedure? apply map for-each force
\#make-promise call-with-current-continuation
call/cc dynamic-wind eval
scheme-report-environment null-environment
interaction-environment
call-with-input-file call-with-output-file
input-port? output-port? current-input-port
current-output-port with-input-from-file
with-output-to-file open-input-file
open-output-file close-input-port
close-output-port
read read-char peek-char eof-object?
write display newline write-char load
;; exported local kludges
\#cond \#setq \#define \#progn \#test \#lambda
backquote list* %load-suffixes)
((access rep)
(open scheme.utils
scheme.syntax
scheme.data
scheme.misc))
(rep#%define \#cond rep#cond)
(rep#%define \#setq rep#setq)
(rep#%define \#define rep#%define)
(rep#%define \#progn rep#progn)
(rep#%define \#lambda rep#lambda)
(rep#%define backquote rep#backquote)
(rep#%define list* rep#list*))
|