On Apr 28, 12:37 pm, Tamas K Papp <······@gmail.com> wrote:
[...]
> I love hash tables as much as the next man (see cl-sparsematrix), but
> here I know that I am not going to deal with more than 20 elements so
> they would be overkill (for me).
Yeah. I was just using your question as a springboard for my own.
However, I did think up with a variation on your version that I kinda
like.
(defun has-duplicates-p (list &optional (test #'equal))
(mapl (lambda (l)
(let ((elt (car l)))
(when (member elt (cdr l) :test test)
(return-from has-duplicates-p (values elt t)))))
list)
(values nil nil)))
Well, OK, the only reason I liked it is I've never used MAPL for
anything before. :)
> That said, I think that what you need for the general case is a
> generic hash table implementation. There is genhash
> (http://www.cliki.net/genhash), but I have never looked at it, I would
> be interested in how it works if anyone has first-hand experience with
> it.
I'll be sure to check it out. Thanks for the pointer.
Cheers,
Pillsy