From: =?ISO-8859-15?Q?Andr=E9_Thieme?=
Subject: generating keyword symbols
Date: 
Message-ID: <d4jrst$49s$1@ulric.tng.de>
How can I generate keyword symbols like :foo ?

make-symbol does not work:
CL-USER> (make-symbol "foo")
#:|foo|
CL-USER> (make-symbol ":foo")
#:|:foo|

What I want is:
CL-USER> (generate-keyword-symbol ":foo")
:foo

Any suggestions how to achieve that?
(if macro or function plays no role)


Andr�
--

From: Paul F. Dietz
Subject: Re: generating keyword symbols
Date: 
Message-ID: <IvOdncWrybAE6vDfRVn-rQ@dls.net>
Andr� Thieme wrote:
> How can I generate keyword symbols like :foo ?
> 
> make-symbol does not work:
> CL-USER> (make-symbol "foo")
> #:|foo|
> CL-USER> (make-symbol ":foo")
> #:|:foo|
> 
> What I want is:
> CL-USER> (generate-keyword-symbol ":foo")
> :foo
> 
> Any suggestions how to achieve that?
> (if macro or function plays no role)

(intern "foo" "KEYWORD") ==> :|foo|

(MAKE-SYMBOL creates uninterned symbols.)

	Paul
From: drewc
Subject: Re: generating keyword symbols
Date: 
Message-ID: <LQebe.1134723$8l.125100@pd7tw1no>
Andr� Thieme wrote:
> 
> What I want is:
> CL-USER> (generate-keyword-symbol ":foo")
> :foo
> 
> Any suggestions how to achieve that?
> (if macro or function plays no role)

The problem you are running into is simple. From the CLHS :

"make-symbol creates and returns a fresh, uninterned symbol whose name 
is the given name."

the important part to note here is "uninterned", meaning the symbol is 
not "INTERN"'d in any package.

Keyword symbols are just normal symbols that are interned in the KEYWORD 
package.. because of this, there is no way to create an uninterned 
KEYWORD symbol (makes sense right?).

try something like this, after reading the relevant parts of the hyperspec :

(defun generate-keyword-symbol (string)
   (intern (string-upcase string) 'keyword))

CL-USER> (generate-keyword-symbol "foo")
:FOO
:EXTERNAL


INTERN is what you need, not make-symbol.

drewc

> 
> 
> Andr�
> -- 


-- 
Drew Crampsie
drewc at tech dot coop
"Never mind the bollocks -- here's the sexp's tools."
	-- Karl A. Krueger on comp.lang.lisp
From: Arthur Lemmens
Subject: Re: generating keyword symbols
Date: 
Message-ID: <opsps8xeiik6vmsw@news.xs4all.nl>
Andr� Thieme wrote:

> How can I generate keyword symbols like :foo ?

(intern "FOO" (find-package "KEYWORD"))

is one way of doing it.
From: =?ISO-8859-15?Q?Andr=E9_Thieme?=
Subject: Re: generating keyword symbols
Date: 
Message-ID: <d4jts9$60l$1@ulric.tng.de>
Thank you *handshaking*


Andr�
--