我一直使用 str 来构造字符串:
user> (str '(1 2 3) " == " '(1 2 3))
"(1 2 3) == (1 2 3)"
大约每天一次,我的屁股被咬到了:
user> (str '(1 2 3) " == " (map identity '(1 2 3)))
"(1 2 3) == clojure.lang.LazySeq@7861"
我想我可以说:
user> (with-out-str (print '(1 2 3) " == " (map identity '(1 2 3))))
"(1 2 3) == (1 2 3)"
相反,但它看起来很难看。有没有更好的办法?