Nп/п : 67 из 93
 От   : Tom Russ                            2:5075/128        05 сен 23 10:27:17
 К    : none) (albert                                         05 сен 23 20:29:02
 Тема : Re: What does (gensym) generate?
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
<df69e26a-63a6-4e13-add0-f6d6544d7f48n@googlegroups.com> 4840edb6
@REPLY:
a9d45092
@REPLYADDR Tom Russ <taruss@google.com>
@REPLYTO 2:5075/128 Tom Russ
@CHRS: CP866 2
@RFC: 1 0
@RFC-References:
<20230831104914.534@kylheku.com>
<8GRTwaqPt+TSAYagO@bongo-ra.co>
@RFC-Message-ID:
<df69e26a-63a6-4e13-add0-f6d6544d7f48n@googlegroups.com>
@TZUTC: -0700
@PID: G2/1.0
@TID: FIDOGATE-5.12-ge4e8b94
On Monday, September 4, 2023 at 4:08:19 AM UTC-7, none albert wrote:

> Suppose I use a name for a symbol that is already present in the environment. 
> I hope that that the new and old symbol are distinct despite having the 
> same name. Otherwise I seriously misunderstand lisp. 

What happens depends on whether the symbol in question is interned or not.

Interned symbols:
 If the reader encounters a symbol with a (package-qualified) name
that is the same
as an already encountered symbol name, then the same symbol is returned. That is
 why the CommonLisp expression (eq `x `x) returns T. Remember that
EQ is object equality.
 So with normal interned symbols, seeing the same name means you
have the same symbol.
 Now the same symbol can be bound to different values in different
environments, but
the symbol object is always the same. So in the following (ignore the ".")
(let ((x 1))
..(print x)
..(let ((x 2))
....(print x))
..(print x))
 The printed values will be 1, 2, 1 because of the lexical bindings
of the LET form, even
though the symbol X is the same symbol object in all the forms.

Uninterned symbols:
 If the reader encounters a symbol with the special syntax indicating
that it is an uninterned
symbol, then a new symbol is created. So that is why the CommonLisp expression
(eq `#:x `#:x) returns NIL.
--- G2/1.0
 * Origin: usenet.network (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх