;; 真正的持久化 FIFO 队列:conj 添加到队尾,
;; peek 和 pop 从队首取
(def int-queue (-> clojure.lang.PersistentQueue/EMPTY
(conj 1) (conj 3) (conj 5)))
;; 队列的打印形式很特殊,所以显示 (vec q)
(println "queue is" (vec int-queue))
(println "top is" (peek int-queue))
(println "first is" (peek int-queue))
(println "second is" (peek (pop int-queue)))
(println "third is" (peek (pop (pop int-queue))))
;; 队首是 1,随后依次得到 1, 3, 5:先进先出