clarify optimization choice

svn: r16588
This commit is contained in:
Eli Barzilay 2009-11-06 22:34:26 +00:00
parent 69e90b7ef3
commit 29184f50ca

View File

@ -189,6 +189,8 @@
;; (append l (car ls) (loop (cdr ls))))))])) ;; (append l (car ls) (loop (cdr ls))))))]))
(define (remove-duplicates l [=? equal?] #:key [key #f]) (define (remove-duplicates l [=? equal?] #:key [key #f])
;; `no-key' is used to optimize the case for long lists, it could be done for
;; shorter ones too, but that adds a ton of code to the result (about 2k).
(define-syntax-rule (no-key x) x) (define-syntax-rule (no-key x) x)
(unless (list? l) (raise-type-error 'remove-duplicates "list" l)) (unless (list? l) (raise-type-error 'remove-duplicates "list" l))
(let ([h (cond [(< (length l) 40) #f] (let ([h (cond [(< (length l) 40) #f]