user=> (eval `'())
()
user=> `'~(map identity ())
(quote ())
user=> (eval `'~(map identity ())) ;;预期:(())
编译器异常:UnsupportedOperationException:未知的集合类型,编译:(NO_SOURCE_PATH:5:1)
user=> (prn *e)
#error {
:cause "Unknown Collection type"
:via
[{:type clojure.lang.Compiler$CompilerException
:message "java.lang.UnsupportedOperationException: Unknown Collection type, compiling:(NO_SOURCE_PATH:5:1)"
:at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6730]}
{:type java.lang.UnsupportedOperationException
:message "Unknown Collection type"
:at [clojure.lang.Compiler$EmptyExpr emit "Compiler.java" 2929]}]
:trace
[[clojure.lang.Compiler$EmptyExpr emit "Compiler.java" 2929]
[clojure.lang.Compiler$BodyExpr emit "Compiler.java" 5905]
[clojure.lang.Compiler$FnMethod doEmit "Compiler.java" 5453]
[clojure.lang.Compiler$FnMethod emit "Compiler.java" 5311]
[clojure.lang.Compiler$FnExpr emitMethods "Compiler.java" 3843]
[clojure.lang.Compiler$ObjExpr compile "Compiler.java" 4489]
[clojure.lang.Compiler$FnExpr parse "Compiler.java" 3983]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 6721]
[clojure.lang.Compiler analyze "Compiler.java" 6524]
[clojure.lang.Compiler eval "Compiler.java" 6779]
[clojure.lang.Compiler eval "Compiler.java" 6745]
[clojure.core$eval invoke "core.clj" 3081]
;;省略其余
nil
user=> (eval `'~(map identity '(x)))
(x)
*原因*:在空列表情况下,编译器这里看到的是一个LazySeq。我怀疑在调用栈更早的地方应该生成一个空列表,但尚未追踪到它。