What is the difference between 1 and '1 in Lisp?

Posted by Jason Baker on Stack Overflow See other posts from Stack Overflow or by Jason Baker
Published on 2010-06-03T14:15:55Z Indexed on 2010/06/03 14:24 UTC
Read the original article Hit count: 176

Filed under:
|
|
|
|

I had never really thought about whether a symbol could be a number in Lisp, so I played around with it today:

> '1
1
> (+ '1 '1)
2
> (+ '1 1)
2
> (define a '1)
> (+ a 1)
2

The above code is scheme, but it seems to be roughly the same in Common Lisp and Clojure as well. Is there any difference between 1 and quoted 1?

© Stack Overflow or respective owner

Related posts about lisp

Related posts about clojure