开发者

Spit and Slurp a vector in Clojure

I am trying to spit a vector like [[1 2 3] [4 5 6]] into a file and later slurp it, but when I slurp it I get a string not a vector. Even if I evaluate the string I 开发者_开发问答get, it is still gives a string. I tried to use (vectors slurpt-string) still it give a one element vector containing the string. Any comments?

Thanks in advance.


clojure.core/read-string

(spit "foo" [[1 2 3] [4 5 6]])

(slurp "foo") ; "[[1 2 3] [4 5 6]]"

(read-string *1) ; [[1 2 3] [4 5 6]]

(type *1) ; clojure.lang.PersistentVector


(read-string "[[1 2 3] [4 5 6]]")

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜