/usr/share/scsh-0.6/misc/sicp.scm is in scsh-common-0.6 0.6.7-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | ; Copyright (c) 1993-1999 by Richard Kelsey and Jonathan Rees. See file COPYING.
; Compatibility mode for use with Abelson & Sussman's book,
; Structure and Interpretation of Computer Programs.
; Requires ERROR, MAKE-TABLE, TABLE-REF, and TABLE-SET!.
; Incompatible change to the meanings of AND and OR
(define (and . rest)
(let loop ((rest rest))
(if (null? rest)
#t
(if (car rest)
(loop (cdr rest))
#f))))
(define (or . rest)
(let loop ((rest rest))
(if (null? rest)
#f
(let ((temp (car rest)))
(if temp
temp
(loop (cdr rest)))))))
; Misc. nonsense
(define-syntax sequence
(syntax-rules ()
((sequence form ...) (begin form ...))))
(define mapcar map)
(define mapc for-each)
(define (1+ x) (+ x 1))
(define (-1+ x) (- x 1))
(define t #t)
(define nil #f)
(define (atom? x) (not (pair? x)))
(define (print x)
(write x)
(newline))
(define princ display)
(define prin1 write)
; Streams
(define-syntax cons-stream
(syntax-rules ()
((cons-stream head tail)
(cons head (delay tail)))))
(define head car)
(define (tail s) (force (cdr s)))
(define the-empty-stream '<the-empty-stream>)
(define (empty-stream? s) (eq? s the-empty-stream))
; EXPLODE and IMPLODE
(define (explode thing)
(map (lambda (c) (string->symbol (string c)))
(string->list (cond ((symbol? thing)
(symbol->string thing))
((number? thing)
(number->string thing))
(else
(error "invalid argument to explode" thing))))))
(define (implode l)
(string->symbol (list->string (map (lambda (s)
(string-ref (symbol->string s) 0))
l))))
; GET and PUT
(define (make-property-module)
(define symbol-properties-table #f)
(define (put symbol indicator value)
(let* ((probe (table-ref symbol-properties-table symbol))
(table (if probe
probe
(let ((table (make-table)))
(table-set! symbol-properties-table symbol table)
table))))
(table-set! table indicator value)))
(define (get symbol indicator)
(let ((probe (table-ref symbol-properties-table symbol)))
(if probe
(table-ref probe indicator)
#f)))
(set! symbol-properties-table (make-table))
(cons get put))
(define property-module (make-property-module))
(define get (car property-module))
(define put (cdr property-module))
; Need these special forms:
; collect make-environment access the-environment
; The following are among the procedures defined in MIT's student
; system; I don't know how many are actually needed for the book:
; ascii char nth nthcdr tyo vector-cons
; accumulate filter map-stream append-streams
|