@@ -43,13 +43,6 @@ in a form that CL expects.
43
43
" Interns a Scheme symbol using one package, with its case inverted."
44
44
(intern (invert-case string ) ' #:r7rs))
45
45
46
- (define-function (%symbol= :inline t :check-type t ) ((symbol-1 symbol ) (symbol-2 symbol ))
47
- (eq symbol-1 symbol-2))
48
-
49
- (defun symbol= (&rest symbols)
50
- " Tests if one or more symbols are equal to each other"
51
- (compare #' %symbol= symbols))
52
-
53
46
(define-function (nanp :inline t ) ((number number ))
54
47
" Tests if a number is NaN"
55
48
(and (floatp number ) (f :float-nan-p number )))
@@ -62,63 +55,6 @@ in a form that CL expects.
62
55
" Tests if a number is both not NaN and not an infinity"
63
56
(not (and (floatp number ) (or (infinitep number ) (nanp number )))))
64
57
65
- (defun eqv? (x y)
66
- "
67
- Tests if two objects are Scheme-equivalent to each other, using the
68
- rules provided in the r7rs-small specification.
69
- "
70
- (typecase x
71
- (symbol (typecase y (symbol (%symbol= x y))))
72
- (inexact? (typecase y (inexact? (= x y))))
73
- (exact? (typecase y (exact? (= x y))))
74
- (character (typecase y (character (char= x y))))
75
- (t (eq x y))))
76
-
77
- ; ;; TODO: If circular and equal?, then this iterates too much because
78
- ; ;; it goes to the first detected part of the cycle rather than to the
79
- ; ;; start of it. It can't just stop at the detection of the cycle
80
- ; ;; because of e.g. '(-1 0 . #1=(1 2 3 4 5 6 7 8 9 . #1#))
81
- (define-function list-equal? ((list1 list ) (list2 list ))
82
- ; ; Note: Tested in a more verbose way so that the list lengths match
83
- ; ; in the ALWAYS test and so lists with cycles always terminate.
84
- (loop :with end? := nil
85
- :with cycle-x := nil
86
- :with cycle-y := nil
87
- :for x := list1 :then (cdr x)
88
- :for y := list2 :then (cdr y)
89
- ; ; For cycle testing to ensure termination
90
- :for x-fast := list1 :then (cddr x-fast)
91
- :for y-fast := list2 :then (cddr y-fast)
92
- :for i :from 0
93
- :until end?
94
- ; ; Recursive equality test
95
- :always (or (and (endp x) (endp y))
96
- (equal? (car x) (car y)))
97
- :do
98
- ; ; End test
99
- (when (or (endp x) (endp y) (eq x cycle-x) (eq y cycle-y))
100
- (setf end? t ))
101
- ; ; Cycle tests
102
- (when (plusp i)
103
- (when (and x-fast (not cycle-x) (eq x x-fast))
104
- (setf cycle-x x))
105
- (when (and y-fast (not cycle-y) (eq y y-fast))
106
- (setf cycle-y y)))))
107
-
108
- (defun vector-equal? (x y)
109
- (and (typep y (type-of x))
110
- (= (length x) (length y))
111
- (loop :for a :across x
112
- :for b :across y
113
- :always (equal? a b))))
114
-
115
- ; ;; TODO: use a sequence-generic comparison when extensible-sequences is used
116
- (defun equal? (x y)
117
- (typecase x
118
- (list (and (listp y) (list-equal? x y)))
119
- (vector (and (vectorp y) (vector-equal? x y)))
120
- (t (eqv? x y))))
121
-
122
58
(defun coerce-subseq (sequence result-type &optional start end)
123
59
" Coerces a subsequence into the result type"
124
60
(let ((subseq (if start
0 commit comments