diff --git a/src/init.scm b/src/init.scm index 6e5a561..fa5ea24 100644 --- a/src/init.scm +++ b/src/init.scm @@ -9,65 +9,7 @@ ; This is a init file for Mini-Scheme. -;; fake pre R^3 boolean values -(define nil #f) -(define t #t) - -(define (caar x) (car (car x))) -(define (cadr x) (car (cdr x))) -(define (cdar x) (cdr (car x))) -(define (cddr x) (cdr (cdr x))) -(define (caaar x) (car (car (car x)))) -(define (caadr x) (car (car (cdr x)))) -(define (cadar x) (car (cdr (car x)))) -(define (caddr x) (car (cdr (cdr x)))) -(define (cdaar x) (cdr (car (car x)))) -(define (cdadr x) (cdr (car (cdr x)))) -(define (cddar x) (cdr (cdr (car x)))) -(define (cdddr x) (cdr (cdr (cdr x)))) - -(define call/cc call-with-current-continuation) - -(define (list . x) x) - -(define (map proc list) - (if (pair? list) - (cons (proc (car list)) (map proc (cdr list))))) - -(define (for-each proc list) - (if (pair? list) - (begin (proc (car list)) (for-each proc (cdr list))) - #t )) - -(define (list-tail x k) - (if (zero? k) - x - (list-tail (cdr x) (- k 1)))) - -(define (list-ref x k) - (car (list-tail x k))) - -(define (last-pair x) - (if (pair? (cdr x)) - (last-pair (cdr x)) - x)) - -(define (head stream) (car stream)) - -(define (tail stream) (force (cdr stream))) - ;;;;; following part is written by a.k - -;;;; atom? -(define (atom? x) - (not (pair? x))) - -;;;; memq -(define (memq obj lst) - (cond - ((null? lst) #f) - ((eq? obj (car lst)) lst) - (else (memq obj (cdr lst))))) ;;;; equal? (define (equal? x y)