From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.devel Subject: Re: Property list key names Date: Sat, 9 Aug 2008 16:52:53 +0200 Message-ID: References: <489DA21E.6040008@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1218293592 31315 80.91.229.12 (9 Aug 2008 14:53:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Aug 2008 14:53:12 +0000 (UTC) Cc: Emacs Devel To: "Lennart Borgman (gmail)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 09 16:54:03 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KRppR-0000lP-73 for ged-emacs-devel@m.gmane.org; Sat, 09 Aug 2008 16:54:01 +0200 Original-Received: from localhost ([127.0.0.1]:54718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KRpoV-0001AU-8a for ged-emacs-devel@m.gmane.org; Sat, 09 Aug 2008 10:53:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KRpoR-000197-DV for emacs-devel@gnu.org; Sat, 09 Aug 2008 10:52:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KRpoN-00017w-1D for emacs-devel@gnu.org; Sat, 09 Aug 2008 10:52:58 -0400 Original-Received: from [199.232.76.173] (port=36445 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KRpoM-00017t-R0 for emacs-devel@gnu.org; Sat, 09 Aug 2008 10:52:54 -0400 Original-Received: from nf-out-0910.google.com ([64.233.182.186]:11271) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KRpoM-0007jY-Io for emacs-devel@gnu.org; Sat, 09 Aug 2008 10:52:54 -0400 Original-Received: by nf-out-0910.google.com with SMTP id c7so527510nfi.26 for ; Sat, 09 Aug 2008 07:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=ovhwrR9qLzRncM5MHqm8UFx/NxUupBvYvlA6dc2ZY/g=; b=frdXyMODyKs6bmdGkZiuogU3OIsRUbziuqrIcKC3+WrAN8F+wv/Rf1NzqWBSkurBAp zrLkOx5cm35yyCJUjE3MRC8EHUkfGD3MMtuo0tOzsPDqZf6RzoVbKeGWh8KSbtUUdEno pWUXwjFZcxQGlB4sMWucOMa2tOvD9kDy166Lk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=salKAhCpM2u6Dn4acuzZnpy2EP21ykv3aRT/a2l3OeBeCw2Z82kt6HmVRIhX4tVDpf Ut6emlsSbd2ZAXYKFQbtBMJegBJWf8+IUNdzetnIMKe6jdHTrQNucar+5ZiKUeeazg2K slxZdxGQZYZ+7qbFMlMek83/C+lBBelJJtl8Q= Original-Received: by 10.210.56.10 with SMTP id e10mr7004024eba.20.1218293573283; Sat, 09 Aug 2008 07:52:53 -0700 (PDT) Original-Received: by 10.210.71.14 with HTTP; Sat, 9 Aug 2008 07:52:53 -0700 (PDT) In-Reply-To: <489DA21E.6040008@gmail.com> Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:102231 Archived-At: On Sat, Aug 9, 2008 at 15:56, Lennart Borgman (gmail) 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 ;-) Juanma