File: unscheme.jl

package info (click to toggle)
librep 0.17-13
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,648 kB
  • ctags: 2,969
  • sloc: ansic: 32,770; lisp: 12,399; sh: 7,971; makefile: 515; sed: 93
file content (115 lines) | stat: -rw-r--r-- 4,085 bytes parent folder | download | duplicates (4)
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
#| unscheme.jl -- cross between scheme and rep

   $Id: unscheme.jl,v 1.4 2000/08/15 13:46:20 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 librep; see the file COPYING.  If not, write to
   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|#

;; The idea here is to make a Scheme-like language that fits better
;; with the rep environment. This is not, and does not claim to be,
;; standards compliant Scheme!

;; The various aberrations that have been introduced are:

;;  #f => ()
;;  #t => t
;;  (eq? #f '()) => #t
;;  (boolean? '()) => #t
;;  (list? #f) => #t
;;  (eq? 'FOO 'foo) => #f
;;  no separate character type

;; and maybe others. But there is a reason for this -- `unscheme' code
;; is able to painlessly call rep code, and vice versa, whereas
;; programs using the stricter `scheme' module cannot do this. It also
;; enables programs to compile down to more efficient byte-code

(define-structure unscheme

    (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 \#lambda backquote list*
     %load-suffixes)

    ((access rep)
     (open unscheme.syntax
	   unscheme.data
	   unscheme.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*))