title: clojure.lang.LazySeq cannot be cast to java.lang.CharSequence
body: <p>I am writing a function that, for any given string, replaces any digits within that String with the same number of '.' characters.</p>
  
  <p>Examples:</p>
  
  <p>AT2X -> AT..X</p>
  
  <p>QW3G45 -> QW...G.........</p>
  
  <p>T3Z1 -> T...Z.</p>
  
  <p>I've written the following Clojure function but I am getting an error I don't quite understand:</p>
  
  <p>java.lang.ClassCastException: clojure.lang.LazySeq (in module: Unnamed Module) cannot be case to java.lang.Charsequence</p>
  
  <p>I'm interpreting from the error that I need to force an evaluation of a lazy sequence back into a String (or CharSequence) but I can't figure out where to do so or if this is correct.</p>
  
  <pre><code>(defn dotify
      ;;Replaces digits with the same number of '.'s for use in traditional board formats
      [FEN]
      (let [values (doall (filter isDigit (seq FEN)))]
          (fn [values]
              (let [value (first values)]
                  (str/replace FEN value (fn dots [number]
                                             (fn [s times]
                                                 (if (&gt; times 0)
                                                     (recur (str s ".") (dec times)))) "" (Character/digit number 10)) value))
          (recur (rest values))) values))
  </code></pre>