title: Why am I getting a LazySeq casting error?
body: <p>I've written the following function</p>
  
  <pre><code>(defn insert-block
    "Given a block, coordinate and playfield, returns the altered playfield.
     Does not check for collisions."
    [[x y] block playfield]
    (let [blocksize (count block)
      insertion (fn [a b] (vector (block a) (playfield b)))
      block-indicies (range 0 blocksize)
      field-indicies (range y (+ y blocksize))]
      (map insertion block-indicies field-indicies))) 
  </code></pre>
  
  <p>Block and playfield are both vectors of vectors. For some reason, every time I call this function, I get the following error:</p>
  
  <pre><code>#&lt;ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn&gt;
  </code></pre>
  
  <p>The function has been simplified a bit from what's in my code - 'insertion' is more complex in the original, but I get the same error regardless. This is driving me nuts - Does anyone have any ideas?</p>
  
  <p>EDIT: I've been testing it with [2 3] for [x y] and [[0 0 0] [0 1 0] [1 1 1]] for block. Playfield is too large to paste here, but it's a vector of 26 vectors containing integers, of length 14.</p>
  
  <p>EDIT2: Here's the playfield vector. </p>
  
  <pre><code>[[1 1 1 1 1 1 1 1 1 1 1 1 1 1]
  [1 1 1 1 1 1 1 1 1 1 1 1 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 0 0 0 0 0 0 0 0 0 0 1 1]
  [1 1 1 1 1 1 1 1 1 1 1 1 1 1]
  [1 1 1 1 1 1 1 1 1 1 1 1 1 1]]
  </code></pre>
  
  <p>EDIT3: I've narrowed it down further - the following code works. It seems that accessing elements in the block and playfield vectors is what's causing the problem, but I still don't know why.</p>
  
  <pre><code>(defn insert-block
  "Given a block, coordinate and playfield, returns the altered playfield.
   Does not check for collisions."
  [[x y] block playfield]
  (let [blocksize (count block)
    insertion (fn [a b] (vector a b))
    block-indicies (range 0 blocksize)
    field-indicies (range y (+ y blocksize))]
    (map insertion block-indicies field-indicies))) 
  </code></pre>
  
  <p>Thanks</p>