From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: How to get plist properties list? Date: Fri, 8 Jan 2021 07:48:46 +0300 Message-ID: References: <7eec4142-3c37-4084-9ea1-73df5df2c821@default> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14873"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0 (3d08634) (2020-11-07) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 08 06:10:40 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kxk2o-0003kH-GW for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 08 Jan 2021 06:10:38 +0100 Original-Received: from localhost ([::1]:55046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxk2n-0003wU-J9 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 08 Jan 2021 00:10:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxjmH-0004wP-2c for help-gnu-emacs@gnu.org; Thu, 07 Jan 2021 23:53:33 -0500 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:49567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxjmE-00083r-Ug for help-gnu-emacs@gnu.org; Thu, 07 Jan 2021 23:53:32 -0500 Original-Received: from localhost ([::ffff:41.210.145.49]) (AUTH: PLAIN securesender, TLS: TLS1.2,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 0000000000296BE9.000000005FF7E547.000056E4; Thu, 07 Jan 2021 21:53:26 -0700 Mail-Followup-To: help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <7eec4142-3c37-4084-9ea1-73df5df2c821@default> Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:127089 Archived-At: As I am replacing here `dotimes': (setq plist '(age "47" name "Doe")) (defun divisible-by-2-or-0-p (n) "Returns t if number is divisible by 2" (if (or (= n 0) (= (/ n 2.0) (truncate (/ n 2.0)))) t nil)) (defun plist-properties (plist) "Returns plist properties" (let* ((length (length plist)) (properties '())) (dotimes (i length (reverse properties)) (if (divisible-by-2-or-0-p i) (push (elt plist i) properties))))) instead of the above complications to extreme length, I have replaced it with this one below: (defun plist-properties (plist) (let ((n 0) (properties '())) (while (/= n (length plist)) (push (elt plist n) properties) (setq n (+ 2 n))) properties)) But maybe there is some more simpler way to get plist properties list? Jean