Re: plist structure
Heime <[email protected]>
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <RoidNUsU_8b1uU9W5fn3pMQLUulKBHQ1FxxJLd1gtFOGS14DR21UjazhyI5PBpu05vw0KrtCDbZOt5qbGsrU1m-mxLuGc7imbMq7xoD5cwg=@protonmail.com> |
On Tuesday, March 24th, 2026 at 12:12 PM, [email protected] <[email protected]> wrote: > Heime <[email protected]> writes: > > > Consider this property list > > > > '(:10pt 283.46456 :pt 28.34646 :mm 10 :in 0.3937 :ft 0.03281) > > > > It looks like a normal list to be, with elements next to each other. > > > > What determines whether a list is a normal list or a plist? Is it > > just the parsing routines that read the same list differently (e.g. > > with plist-get)? > > > > In Emacs Lisp, the function ‘plistp’ determines whether a > list is a property list. > > (plistp (list 'a 'b)) > ;;=> t > (plistp (list 'a 'b 'c)) > ;;=> nil > (plistp (list 'a 'b 'c 9)) > ;;=> t > > See more in the Emacs Lisp reference manual: (info "(elisp) Property Lists") Right. This is basically a matter of interpretation, if plistp determines that the list is a plist if there are even number of elements. I have done a few more tests The following gave me :cm (car '(:cm (:10pt 283.46456 :pt 28.34646 :mm 10 :in 0.39370 :ft 0.03281) :in (:10pt 720 :pt 72 :mm 25.4 :cm 2.54 :ft 0.083333))) And this (cdr '(:cm (:10pt 283.46456 :pt 28.34646 :mm 10 :in 0.39370 :ft 0.03281) :in (:10pt 720 :pt 72 :mm 25.4 :cm 2.54 :ft 0.083333))) gave ((:10pt 283.46456 :pt 28.34646 :mm 10 :in 0.3937 :ft 0.03281) :in (:10pt 720 :pt 72 :mm 25.4 :cm 2.54 :ft 0.083333)) But then plist-get considers the structure as key val key val ... > -- > The lyf so short, the craft so long to lerne. > - Geoffrey Chaucer, The Parliament of Birds.