You are not logged in.
Pages: 1
i don't get properties in lisp. i did
(setq stuff '((color red) (size big) (shape square))
(get 'stuff 'color)
but it returns nil. i thought it was supposed to return red. i know get returns nil if no property with the given name exists, but when i type stuff it shows the association list. Anyone know whats wrong?
Offline
EDIT:
Sorry, I was looking at an out of date reference. I think you want something like (setf (get 'stuff 'color) 'red).
Dang, when I was typing that I kept hitting vi keys and making who knows what happen. I'm not used to typing code in a web browser.
Offline
hope it help you & me.
I removed my sig, cause i select the flag, the flag often the target of enemy.
SAR brain-tumor
[img]http://img91.imageshack.us/img91/460/cellphonethumb0ff.jpg[/img]
Offline
Also, the appendix in Common Lisp the Language 2 (available online) is a godsend.
What are you using properties for anyway? They don't seem to useful to me.
Offline
no reason, and i thought (setf (get 'stuff 'color) 'red) was for changing the property color of the symbol stuff to red from something else. I have common lisp the first edition but its still shrink wrapped so i didn't open it because i also found Lisp second edition by patrick henry winston and berthold klaus paul horn.
Offline
no reason, and i thought (setf (get 'stuff 'color) 'red) was for changing the property color of the symbol stuff to red from something else
It's for both changing it and setting it in the first place. Apparently it used to be done with PUT, but that was removed in favor of SETF.
Offline
Pages: 1