File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,8 @@ macros, and comparators:
247
247
- ` number-comparator ` is a default comparator for numbers that is more general
248
248
than SRFI 162's ` real-comparator ` .
249
249
250
+ - ` fixnum-comparator ` is a default comparator for fixnums (small integers).
251
+
250
252
- ` (make-sum-comparator <comparators>…) ` creates a comparator for the _ sum type_
251
253
of the types represented by each comparator in ` <comparators> ` . For example,
252
254
` (make-sum-comparator boolean-comparator number-comparator string-comparator) `
Original file line number Diff line number Diff line change 27
27
(export comparator-max comparator-min
28
28
comparator-max-in-list comparator-min-in-list
29
29
default-comparator boolean-comparator real-comparator
30
- char-comparator char-ci-comparator
30
+ fixnum-comparator char-comparator char-ci-comparator
31
31
string-comparator string-ci-comparator
32
32
pair-comparator list-comparator vector-comparator
33
33
eq-comparator eqv-comparator equal-comparator)
97
97
((x) (let ((y 0 )) . body))
98
98
((x y) . body))))))
99
99
100
+ (cond-expand
101
+ ((and (not chicken) (library (srfi 143 )))
102
+ (import (srfi 143 ))
103
+ (begin
104
+ (define fixnum-comparator
105
+ (make-comparator fixnum? fx=? fx<? (hash-lambda (x) x)))))
106
+ (gerbil
107
+ (import (std srfi 143 ))
108
+ (begin
109
+ (define fixnum-comparator
110
+ (make-comparator fixnum? fx=? fx<? (hash-lambda (x) x)))))
111
+ (else
112
+ (begin
113
+ (define fixnum-comparator
114
+ (make-comparator
115
+ (λ x (and (number? x) (exact? x) (integer? x)))
116
+ =
117
+ <
118
+ (hash-lambda (x) x))))))
119
+
100
120
(cond-expand
101
121
((and (not chicken) (not gauche) (library (srfi 162 )))
102
122
(import (srfi 162 )))
You can’t perform that action at this time.
0 commit comments