   (if (seq l)
     (do
       (assert (first l))
-      (recur (call-cmd (first l) text)(rest l)))
+      (let [res (call-cmd (first l) text)]
+        (println (str (first l) " => " res))
+        (recur res (rest l))))
     text))
 
 (defn process
   ([text](process text (str/split-lines mydata)))
   ([text l](process-2 text l)))
+
+
+(def testdata
+  "swap position 4 with position 0
+swap letter d with letter b
+reverse positions 0 through 4
+rotate left 1 step
+move position 1 to position 4
+move position 3 to position 0
+rotate based on position of letter b
+rotate based on position of letter d
+")
+
+(defn sample
+  []
+  (process "abcde" (str/split-lines testdata)))
 
 
 (def mydata

   spyscope.core
   adventofcode1.spec-test-instrument-debug))

(defn catvec
  [a b]
  (vec (concat a b)))

  "Apply cmd to text. Return text as is if cmd isn't this cmd"
  [cmd text]
  (if-let [[_ fr] (re-find (re-matcher #"^rotate left (\d+) steps?$" cmd))]
    (rotate-left text (parse-int fr))))


(defn rotate-based-on
  [text fr]
  (if-let [idx (str/index-of text fr)]
    (rotate-right text (inc (if (>= idx 4)(inc idx) idx)))))



;; rotate based on position of letter X means that the whole string
;; should be rotated to the right based on the index of letter X
