;;;; Equality
+;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/equals.scm,v 1.10 1986/12/16 19:36:12 cph Exp $
+
(declare (usual-integrations))
\f
(let-syntax ((type?
;; numbers specially, but it turns out that EQ? does the right thing
;; for everything but numbers, so we take advantage of that.
(if (eq? x y)
- #T
+ true
(and (primitive-type? (primitive-type x) y)
(or (type? big-fixnum y)
(type? big-flonum y))
(define (equal? x y)
(if (eq? x y)
- #T
+ true
(and (primitive-type? (primitive-type x) y)
(cond ((or (type? big-fixnum y)
(type? big-flonum y))
((type? vector y)
(let ((size (vector-length x)))
(define (loop index)
- (or (= index size)
+ (if (= index size)
+ true
(and (equal? (vector-ref x index)
(vector-ref y index))
(loop (1+ index)))))
;;; future releases; and (b) to inform MIT of noteworthy uses of
;;; this software.
;;;
-;;; 3. All materials developed as a consequence of the use of
-;;; this software shall duly acknowledge such use, in accordance
-;;; with the usual standards of acknowledging credit in academic
+;;; 3. All materials developed as a consequence of the use of this
+;;; software shall duly acknowledge such use, in accordance with
+;;; the usual standards of acknowledging credit in academic
;;; research.
;;;
;;; 4. MIT has made no warrantee or representation that the
;;; under no obligation to provide any services, by way of
;;; maintenance, update, or otherwise.
;;;
-;;; 5. In conjunction with products arising from the use of this
+;;; 5. In conjunction with products arising from the use of this
;;; material, there shall be no use of the name of the
;;; Massachusetts Institute of Technology nor of any adaptation
;;; thereof in any advertising, promotional, or sales literature
;;;; List Operations
+;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/list.scm,v 1.64 1986/12/16 19:36:45 cph Exp $
+
(declare (usual-integrations))
\f
;;; This IN-PACKAGE is just a kludge to prevent the definitions of the
elements)
(define (list? frob)
- (or (null? frob)
- (and (pair? frob)
- (list? (cdr frob)))))
+ (cond ((null? frob) true)
+ ((pair? frob) (list? (cdr frob)))
+ (else false)))
(define (cons* first-element . rest-elements)
(define (loop this-element rest-elements)
(define (for-all? predicate)
(define (loop objects)
- (or (not (pair? objects))
+ (if (pair? objects)
(and (predicate (car objects))
- (loop (cdr objects)))))
+ (loop (cdr objects)))
+ true))
loop)
\f
;;;; Generalized List Operations
((positive-list-searcher (lambda (items)
(predicate (car items)))
car
- #!FALSE)
+ false)
list))
(define (list-search-negative list predicate)
((negative-list-searcher (lambda (items)
(predicate (car items)))
car
- #!FALSE)
+ false)
list))
\f
;;;; Membership Lists
((positive-list-searcher (lambda (sub-list)
(pred (car sub-list) element))
identity-procedure
- #!FALSE)
+ false)
list))
;(define memq (member-procedure eq?))
(define delq! (delete-member-procedure list-deletor! eq?))
(define delv! (delete-member-procedure list-deletor! eqv?))
(define delete! (delete-member-procedure list-deletor! equal?))
-\f
+
;;;; Association Lists
(define ((association-procedure pred selector) key alist)
((positive-list-searcher (lambda (sub-alist)
(pred (selector (car sub-alist)) key))
car
- #!FALSE)
+ false)
alist))
;(define assq (association-procedure eq? car))