|
From: | Lennart Borgman (gmail) |
Subject: | Re: Property list key names |
Date: | Sat, 09 Aug 2008 17:02:21 +0200 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 |
Juanma Barranquero wrote:
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?
Just a mistake.
(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).
Ok, thanks.
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 ;-)
But I learned something ;-)
Juanma
[Prev in Thread] | Current Thread | [Next in Thread] |