On Sun, Dec 11, 2016 at 07:05:13PM +0000, dean wrote:
> In the tutorial '(X Y Z) in a get statement seemed to refer to several keys
> but I'd like a list of letters to be a single key.
> Is this not possible?
> (setq X "")
> (put 'X '(D E) 'some_value)
> : (get 'X '(D E))
> -> NIL
Properties are handled (searched) by pointer-equality, the '==' function. So you
*could* use numbers or lists as keys. But you must understand then exactly what
this implies, to avoid unexpected behavior.
: (put 'X (setq L '(D E)) 'some_value)
: (get 'X L)
This works because you use the *same* list '(D E)' as key both for 'put' and
In your example, you read the list *two* times, so they are different cells in
memory. They are '=', but not '=='.
: (== L L)
: (== L '(D E))
: (= L '(D E))