help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

best way to get the list of unique keys from 2 alists


From: Kevin Rodgers
Subject: best way to get the list of unique keys from 2 alists
Date: Fri, 16 Dec 2005 10:47:53 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

I've got 2 alists of (SYMBOL . "STRING") pairs, and I need to get the
list of unique symbol names to pass to completing-read as its TABLE
argument: (("SYMBOL-NAME") ...)

I know about remove-duplicates and union, but I'd like to avoid using
cl*.el functions.

Since completing-read seems to ignore nil entries in TABLE, this is what
I've got now:

(nconc (mapcar (lambda (assoc)
                 (list (symbol-name (car assoc))))
               alist-1)
       (mapcar (lambda (assoc)
                 (or (assq (car assoc) alist-1)
                     (list (symbol-name (car assoc)))))
               alist-2))

Is there a cleaner way?

Thanks,
--
Kevin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]