From: masti
Subject: Problem using symbols in clisp
Date: 
Message-ID: <coquor$701$1@atlantis.news.tpi.pl>
I've got a problem as follows:
After creating symbol using (make-symbol) form:
(make-symbol "4")
 I find it impossible to refer to that symbol afterwards in my program. The 
problem is that in form
(get 'prop '4) interpreter treats 4 like number and what I want to do is to 
refer to previously created symbol. Is there any way to do it? 

From: Kaz Kylheku
Subject: Re: Problem using symbols in clisp
Date: 
Message-ID: <cf333042.0412031744.389ba338@posting.google.com>
"masti" <·········@tenbit.pl> wrote in message news:<············@atlantis.news.tpi.pl>...
> I've got a problem as follows:
> After creating symbol using (make-symbol) form:
> (make-symbol "4")
>  I find it impossible to refer to that symbol afterwards in my program. The 
> problem is that in form
> (get 'prop '4) interpreter treats 4 like number and what I want to do is to 
> refer to previously created symbol. Is there any way to do it?

This is not a CLISP behavior but simply a Lisp behavior. When a token
consists of purely unescaped digits, it's converted to an integer
object.

The solution is to escape at least one of the digits. That digit then
loses its special magic power and is just a plain constituent
character.

(get 'prop \4)  ;; single character escape

(get 'prop |4|) ;; or: multi-character escape with pipes.
From: Pascal Bourguignon
Subject: Re: Problem using symbols in clisp
Date: 
Message-ID: <87hdn29uhw.fsf@thalassa.informatimago.com>
···@ashi.footprints.net (Kaz Kylheku) writes:

> "masti" <·········@tenbit.pl> wrote in message news:<············@atlantis.news.tpi.pl>...
> > I've got a problem as follows:
> > After creating symbol using (make-symbol) form:
> > (make-symbol "4")
> >  I find it impossible to refer to that symbol afterwards in my program. The 
> > problem is that in form
> > (get 'prop '4) interpreter treats 4 like number and what I want to do is to 
> > refer to previously created symbol. Is there any way to do it?
> 
> This is not a CLISP behavior but simply a Lisp behavior. When a token
> consists of purely unescaped digits, it's converted to an integer
> object.
> 
> The solution is to escape at least one of the digits. That digit then
> loses its special magic power and is just a plain constituent
> character.
> 
> (get 'prop \4)  ;; single character escape
> 
> (get 'prop |4|) ;; or: multi-character escape with pipes.

Yes, but get is a function that evaluates its argument. If the symbol
|4| is not bound to another symbol these get will fail.


Either:

(get 'prop '\4)  ; get the property list of the symbol |4| interned in *package*
(get 'prop '|4|) ; (whose name is "4")


Or:

(defparameter mysym (make-symbol "4"))
(get 'prop mysym) ; get the property list of the uninterned symbol |4| 
(get 'prop mysym) ; (whose name is "4")
                  

Or:

(defparameter |4| 'some-sym)
(get 'prop \4)  ; get the property list of the symbol some-sym interned in 
(get 'prop |4|) ; *package* (whose name is "SOME-SYM")



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.
From: Barry Margolin
Subject: Re: Problem using symbols in clisp
Date: 
Message-ID: <barmar-47FBFA.20303003122004@comcast.dca.giganews.com>
In article <············@atlantis.news.tpi.pl>,
 "masti" <·········@tenbit.pl> wrote:

> I've got a problem as follows:
> After creating symbol using (make-symbol) form:
> (make-symbol "4")
>  I find it impossible to refer to that symbol afterwards in my program. The 
> problem is that in form
> (get 'prop '4) interpreter treats 4 like number and what I want to do is to 
> refer to previously created symbol. Is there any way to do it? 

MAKE-SYMBOL creates an uninterned symbol.  If you want to use that 
symbol, you need to assign it to a variable, and then you can use that 
in other expressions:

(defvar *four* (make-symbol "4"))
(get *four* 'prop)

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
From: William Bland
Subject: Re: Problem using symbols in clisp
Date: 
Message-ID: <pan.2004.12.04.00.07.53.172780@abstractnonsense.com>
On Sat, 04 Dec 2004 00:55:37 +0100, masti wrote:

> I've got a problem as follows:
> After creating symbol using (make-symbol) form:
> (make-symbol "4")
>  I find it impossible to refer to that symbol afterwards in my program. The 
> problem is that in form
> (get 'prop '4) interpreter treats 4 like number and what I want to do is to 
> refer to previously created symbol. Is there any way to do it?

You can escape symbols that have funny characters in them using the |
character at each end of the symbol.  So your (get 'prop '4) would become
(get 'prop '|4|)

Best wishes,
		Bill.
From: Kenny Tilton
Subject: Re: Problem using symbols in clisp
Date: 
Message-ID: <g6asd.19746$Yh2.7441959@twister.nyc.rr.com>
masti wrote:
> I've got a problem as follows:
> After creating symbol using (make-symbol) form:
> (make-symbol "4")
>  I find it impossible to refer to that symbol afterwards in my program. The 
> problem is that in form
> (get 'prop '4) interpreter treats 4 like number and what I want to do is to 
> refer to previously created symbol. Is there any way to do it? 

You have gotten some good answers. May I ask a better question? WTF are 
you doing???!!!!

:)

Just concerned that some deeper misunderstanding is in play and going 
unaddressed. I mean, Lisp /has/ arrays and make-hash-table and...

kenny

-- 
Cells? Cello? Celtik?: http://www.common-lisp.net/project/cells/
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film