chunk-append

added

ns
clojure.core

type
function

(chunk-append b x)


        

                (let [buf (chunk-buffer 16)]
  ;; Mutably append elements to the ChunkedBuffer
  (dotimes [n 10]
    (chunk-append buf n))

  ;; Demonstrate pulling elements out.
  ;; Note that the `capacity` we set above (16) for `buf`.
  (let [ch (chunk buf)]
    (for [n (range 0 17)]
      (try (.nth ch n)
           (catch ArrayIndexOutOfBoundsException e
             "too far!")))))

;; => (0 1 2 3 4 5 6 7 8 9 nil nil nil nil nil nil "too far!")