[Top][All Lists]

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

Re: Property list key names

From: Juanma Barranquero
Subject: Re: Property list key names
Date: Sat, 9 Aug 2008 16:52:53 +0200

On Sat, Aug 9, 2008 at 15:56, Lennart Borgman (gmail)
<address@hidden> wrote:

> I guess there is something like this function in Emacs:

I don't think there's one...

> (defun property-list-keys (plist)
>  "Return list of key names in property list PLIST."
>  (let ((keys)
>        (plist (copy-list plist)))

Why do you copy plist?

>    (while plist
>      (setq keys (cons (car plist) keys))
>      (setq plist (cddr plist)))
>    keys))

> What is the name of it?

It's easy enough to implement, and not much needed (apparently).

If you're using CL, you can get fancy

(defun  property-list-keys (plist)
  (let ((c 0))
    (remove-if #'(lambda (ignore) (zerop (mod (incf c) 2))) plist)))

(not that it is better or clearer than your version, of course ;-)


reply via email to

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