Reputation: 99
Inside common lisp, I have a variable 'name' defined as:
(setq name ':length-1)
>> :length-1
Now I want to make a plist using this variable and I want it to look like:
(:length-1 10)
Is there a way to define the key of the plist using another defined variable?
I have tried 'format' but that gives me a string and not the symbol:
(list (format nil ":~a" name) 10)
but this gives me:
(":lifting-surface" 10)
Upvotes: 0
Views: 250
Reputation: 22646
It looks like you are trying to make a keyword symbol from a string, I would suggest the make-keyword function from the alexandria library which looks like this:
(defun make-keyword (name)
"Interns the string designated by NAME in the KEYWORD package."
(intern (string name) :keyword))
EDIT: Oh, I see that you are not, but this might be useful anyways.
Upvotes: 1
Reputation: 782130
This should do it:
(list name 10)
But if you're getting ":lifting-surface"
rather than ":length-1"
when you use format
, you must have changed the value of name
.
Upvotes: 3