Fork me on GitHub
#clojure-dev
<
2017-12-05
>
Yehonathan Sharvit06:12:05

I’m trying to understand why

(def x :A)
(list 'quote x)
evaluates to ':A Any explanation?

Yehonathan Sharvit06:12:27

I thought it would evaluate to a list of two arguments: (quote :A)

dpsutton06:12:30

advent.day5> (def x :A)
#'advent.day5/x
advent.day5> (list 'quote x)
(quote :A)

dpsutton06:12:41

but we should probably head to clojure not clojure-dev

gfredericks12:12:15

I think it's evaluating to what you expect, but some part of whatever printer you're using is trying to be clever and converting (quote ___) to '___

Yehonathan Sharvit06:12:33

Thanks @U11BV7MTK and @U0GN0S72R Do you know why pprint evals the list? user=> (clojure.pprint/pprint (list ‘quote :a)) ’:a nil user=>

gfredericks02:12:52

it's not evaling the list, it's just printing it in a reader-equivalent way

gfredericks02:12:06

(= ':a (list 'quote :a))