Strange function symbol?

Started by HPW, November 23, 2003, 10:15:02 AM

Previous topic - Next topic

HPW


newLISP v7.3.8 Copyright (c) 2003 Lutz Mueller. All rights reserved.

> (set (symbol "var") 345)
345
> (symbol? var)
nil
>


Why does it return nil?
Hans-Peter

Lutz

#1
the function 'symbol?' evaluates its argument first, the contents of var was not a symbol but 345:



(set 'x 'var) = > var



(symbol? x) => true   ;; checks the contents of x which is the symbol var



(symbol? (first '(var x y z))) => true



etc.



Lutz

HPW

#2
Oops, thanks for the explanation.
Hans-Peter

HPW

#3

(set 'var any-thing)
(symbol? any-thing)     => true


The doc is not that clear.
Hans-Peter

Lutz

#4
the doc is wrong ;-)



I'll correct this



Lutz