clojure.core/seque接受一个可选参数,可以是LinkedBlockingQueue的初始容量或BlockingQueue接口的实例。
PriorityBlockingQueue就是这样一个类,但因为seque对BlockingQueue做了一些假设,这些假设并不适用于所有BlockingQueue,因此无法正常工作。
user=> (def s (seque (java.util.concurrent.PriorityBlockingQueue. 100) (shuffle (range 100))))
'user/s
user=> s
java.lang.NullPointerException
user=> (seque (java.util.concurrent.SynchronousQueue.) (shuffle (range 100)))
user=> (seque (java.util.concurrent.ArrayBlockingQueue. 10) (shuffle (range 100)))
(39 41 27 76 1 24 92 34 72 37 67 99 38 21 5 64 9 26 59 43 82 65 3 11 31 93 50 63 15 90 13 75 40 97 57 88 86 53 19 83 2 12 54 49 71 28 68 73 96 44 8 98 61 6 22 25 78 66 32 84 60 94 70 7 89 4 33 55 74 81 51 56 62 87 69 80 77 20 30 91 52 10 48 18 36 58 47 14 16 42 35 17 95 0 45 85 29 23 46 79)