Hi Leo, I agree that this is a good idea.
Please use (ice-9 match) instead of car and cdr.
Something among these lines would be more transparent:
(define (find-duplicates list accessor)
(match list
(() '())
((head . tail)
(if (member head tail accessor) ; (srfi srfi-1) member
(cons head (find-duplicates tail accessor))
(find-duplicates tail accessor)))))
(find-duplicates users
(lambda (a b)
(string=? (user-account-name a)
(user-account-name b)))
(I think one could also use srfi-1 delete-duplicates and then compare the
lengths. Then the entire thing is a one-liner--the only complication is
to find the duplicates again after doing it (for the error message))
pgptAybaqN8Av.pgp
Description: OpenPGP digital signature
