From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.help Subject: design ponderings: plist to alist Date: Wed, 16 Apr 2014 07:48:34 +0200 Message-ID: <87a9bl7rkd.fsf@zigzag.favinet> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1397627094 30465 80.91.229.3 (16 Apr 2014 05:44:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Apr 2014 05:44:54 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 16 07:44:47 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WaIeM-0000JC-Fh for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Apr 2014 07:44:46 +0200 Original-Received: from localhost ([::1]:52931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WaIeL-0002f7-U7 for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Apr 2014 01:44:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WaIe3-0002en-C1 for help-gnu-emacs@gnu.org; Wed, 16 Apr 2014 01:44:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WaIdv-0006LV-Nw for help-gnu-emacs@gnu.org; Wed, 16 Apr 2014 01:44:27 -0400 Original-Received: from smtp205.alice.it ([82.57.200.101]:54978) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WaIdv-0006LM-BS for help-gnu-emacs@gnu.org; Wed, 16 Apr 2014 01:44:19 -0400 Original-Received: from zigzag.favinet (79.30.64.102) by smtp205.alice.it (8.6.060.28) id 529A59311DE5B4EB for help-gnu-emacs@gnu.org; Wed, 16 Apr 2014 07:44:17 +0200 Original-Received: from ttn by zigzag.favinet with local (Exim 4.80) (envelope-from ) id 1WaIiC-00050q-Ad for help-gnu-emacs@gnu.org; Wed, 16 Apr 2014 07:48:44 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.101 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:97145 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain This fragment (from gnugo.el): --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline Content-Transfer-Encoding: quoted-printable (let ((root (gnugo--root-node))) (cl-flet ((r! (&rest plist) (gnugo--decorate root (loop ; hmm, available elsewhere? while plist collect (let* ((k (pop plist)) (v (pop plist))) (cons k v)))))) (r! :SZ board-size :DT (format-time-string "%Y-%m-%d") :RU (if (string-match "--chinese-rules" args) "Chinese" "Japanese") :AP (cons "gnugo.el" gnugo-version) :KM komi) (let ((gb (gnugo--blackp (gnugo-other user-color)))) (r! (if gb :PW :PB) (user-full-name) (if gb :PB :PW) (concat "GNU Go " (gnugo-query "version")))) (unless (zerop handicap) (r! :HA handicap :AB (mapcar (gnugo--as-cc-func) (gnugo-lsquery "fixed_handicap %d" handicap)))))) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable includes a function to convert plist (succinct to humans) to alist (succinct to computers). I spent 20 minutes poking around the Emacs source searching for something builtin, to no avail. I saw a few cases of the opposite direction (alist to plist) and many cases where plists are walked at time of use (e.g., the C code for text-properties), so maybe this is a hint that plist to alist (pre-use) is a net lose. :-/ What do people think? =2D-=20 Thien-Thi Nguyen GPG key: 4C807502 (if you're human and you know it) read my lisp: (responsep (questions 'technical) (not (via 'mailing-list))) =3D> nil --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlNOGbUACgkQZwMiJEyAdQImTgCgvs6QneIGviWd0bMyhQNIZE22 C7kAoKUmUz0sEuHcokfyAXKm6NvUklT1 =xibq -----END PGP SIGNATURE----- --==-=-=--