             (recur (cons current acc) (next coll) (fib-border length)))
           (fold acc))))))
 
-(defmulti rope-concat (fn [rope1 rope2] [(type rope1) (type rope2)]))
+(defmulti rope-concat
+  "Concatenation of two Ropes, including Strings which are treated as leafes"
+  (fn [rope1 rope2] [(type rope1) (type rope2)]))
 (defmethod rope-concat [String String] [string1 string2] (str string1 string2))
 (defmethod rope-concat :default [coll1 coll2]
   (let [new-rope (rope coll1 coll2)]

                (recur next l-index)))
            :default (throw (IndexOutOfBoundsException. (str "String index out of range: " index)))))))

(defn rope-seq [rope]
  (for [node (iterate zip/next (rope-zip rope)) :while (not (zip/end? node))]
    (zip/node node)))

(defn rope-str [rope]
  (->> (rope-seq rope) (filter string?) (reduce str)))

(defn rope-rebalance [coll] 
  (let [fold (fn [coll] (reduce rope (reverse coll)))
        fib-border (fn [limit] (->> *fib-seq* (take-while #(>= limit %)) last))]
    (loop [acc (), coll (->> (rope-seq coll) (filter string?)), max-length nil]
      (let [current (first coll), length (count current)]
        (if current
          (if (and (seq acc) (>= length max-length))

             (str (subs part1 position1) middle-rope (subs part2 0 position2)))
           (subs part1 position1 (+ position1 length)))))))

(defn rope-delete
  "Delete the characters at interval [start..end] in the Rope"
  [root start end]
  {:pre [(>= (- end start) 0)]}
  (if (= end (count root))
    (let [[left-rope part _ position] (rope-split-at root start)]
      (rope-conj left-rope (subs part 0 position)))
    (let [[left-rope part1 _ position1] (rope-split-at root start)
          [_ part2 right-rope position2] (rope-split-at root end)]
      (rope-concat (rope-conj left-rope (subs part1 0 position1) (subs part2 position2))
                   right-rope))))

