What's the difference between '() and (list) in Clojure?

后端 未结 3 1258
我在风中等你
我在风中等你 2020-12-17 09:56

The API Cheatsheet section on Lists seems to indicate that \'() is a list constructor, just like (list), but I\'ve found that in practice they\'re

3条回答
  •  轮回少年
    2020-12-17 10:17

    The difference is that, as you can see, the literal syntax '() is quoted. This means symbols inside are not evaluated. To use list literals while evaluating the elements you can exploit the syntax-quote reader macro:

    user=> (apply str `(~foo ~bar ~zip))
    "abc"
    

提交回复
热议问题