如何使用Clojure的PersistentQueue?

时间:2017-03-31 22:52:53

标签: clojure

https://stackoverflow.com/a/2495105/261952中有人声称它的作用是这样的:

(-> (clojure.lang.PersistentQueue/EMPTY)
      (conj 1 2 3)
      pop)
(2 3)

然而,当我在我的REPL中尝试这个时,我得到了这个结果:

=> #object[clojure.lang.PersistentQueue 0x11f5966 "clojure.lang.PersistentQueue@402"]

由于该帖子已有7年历史,因此行为可能已发生变化。 我今天如何使它工作(Clojure 1.8)?

1 个答案:

答案 0 :(得分:2)

它仍然有效。将seq添加到线程以查看其中包含的内容:

(-> (clojure.lang.PersistentQueue/EMPTY)
    (conj 1 2 3)
    pop
    seq)
;(2 3)
相关问题