* Why does assq fail when getting quoted value from a property list?
@ 2018-08-06 3:55 Cody Goodman
2018-08-06 7:29 ` tomas
0 siblings, 1 reply; 4+ messages in thread
From: Cody Goodman @ 2018-08-06 3:55 UTC (permalink / raw)
To: help-gnu-emacs
This returns (urgent . 2) as I'd expect:
(assq 'urgent '((urgent . 2)))
Why does this not return the same?
(let ((lookup (plist-get '(:severity (quote urgent)) :severity)))
(assq lookup '((urgent . 2))))
Thanks,
Cody
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why does assq fail when getting quoted value from a property list?
2018-08-06 3:55 Why does assq fail when getting quoted value from a property list? Cody Goodman
@ 2018-08-06 7:29 ` tomas
2018-08-06 11:53 ` Noam Postavsky
0 siblings, 1 reply; 4+ messages in thread
From: tomas @ 2018-08-06 7:29 UTC (permalink / raw)
To: help-gnu-emacs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sun, Aug 05, 2018 at 10:55:05PM -0500, Cody Goodman wrote:
> This returns (urgent . 2) as I'd expect:
>
> (assq 'urgent '((urgent . 2)))
>
> Why does this not return the same?
>
> (let ((lookup (plist-get '(:severity (quote urgent)) :severity)))
> (assq lookup '((urgent . 2))))
Because the value of (plist-get '(:severity (quote urgent) :severity)
is the symbol 'urgent (and not the symbol urgent, as you probably expect).
IOW, '(:severity (quote urgent) :severity) is quoting the 'urgent twice,
so to speak (one is the outer '(...), the other is the inner, explicit
(quote ...)
HTH
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAltn+OAACgkQBcgs9XrR2kZMwwCggb8mFi/3CKrlpETxudgZbW6A
mVUAn1jcBAQ/1UWNNNkzLaBhelZRqGlF
=56TD
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why does assq fail when getting quoted value from a property list?
2018-08-06 7:29 ` tomas
@ 2018-08-06 11:53 ` Noam Postavsky
2018-08-06 13:27 ` tomas
0 siblings, 1 reply; 4+ messages in thread
From: Noam Postavsky @ 2018-08-06 11:53 UTC (permalink / raw)
To: tomas; +Cc: Help Gnu Emacs mailing list
On 6 August 2018 at 03:29, <tomas@tuxteam.de> wrote:
>> (let ((lookup (plist-get '(:severity (quote urgent)) :severity)))
>> (assq lookup '((urgent . 2))))
>
> Because the value of (plist-get '(:severity (quote urgent) :severity)
> is the symbol 'urgent
You mean the list of two symbols `quote' and `urgent'.
(equal (list 'quote 'urgent)
(plist-get '(:severity (quote urgent)) :severity))
;=> t
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why does assq fail when getting quoted value from a property list?
2018-08-06 11:53 ` Noam Postavsky
@ 2018-08-06 13:27 ` tomas
0 siblings, 0 replies; 4+ messages in thread
From: tomas @ 2018-08-06 13:27 UTC (permalink / raw)
To: Noam Postavsky; +Cc: Help Gnu Emacs mailing list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Mon, Aug 06, 2018 at 07:53:51AM -0400, Noam Postavsky wrote:
> On 6 August 2018 at 03:29, <tomas@tuxteam.de> wrote:
>
> >> (let ((lookup (plist-get '(:severity (quote urgent)) :severity)))
> >> (assq lookup '((urgent . 2))))
> >
> > Because the value of (plist-get '(:severity (quote urgent) :severity)
> > is the symbol 'urgent
>
> You mean the list of two symbols `quote' and `urgent'.
Hmpf. You're right. "Evaluation" of quote happens later...
Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAltoTKcACgkQBcgs9XrR2kYEnACeK6VGvPCf1/kt5WfBV0KmkXmE
qcIAoIEsJB6keRSXF62ZVADU95I6UhD+
=17gs
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-06 13:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-06 3:55 Why does assq fail when getting quoted value from a property list? Cody Goodman
2018-08-06 7:29 ` tomas
2018-08-06 11:53 ` Noam Postavsky
2018-08-06 13:27 ` tomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).