Error in the sample implementation
Marc Nieper-WiÃkirchen 18 Sep 2020 18:03 UTC
I just found a bug in the sample implementation by chance, namely in
the definition of ‘delete-duplicates!’, which is missing a "." before
‘maybe-=’. The sad thing about it is that Scheme is apparently used so
seldom that no come across the bug for 20 years.
(define (delete-duplicates! lis <DOT> maybe-=)
(let ((elt= (:optional maybe-= equal?)))
(check-arg procedure? elt= delete-duplicates!)
(let recur ((lis lis))
(if (null-list? lis) lis
(let* ((x (car lis))
(tail (cdr lis))
(new-tail (recur (delete! x tail elt=))))
(if (eq? tail new-tail) lis (cons x new-tail)))))))