   "Reduces a `cat`, whenever possible."
   [cat-op]
   (cond (every? #(= :string (:type %)) (:args cat-op))
+        ;; This is not general enough. (cat "f" "g" expr [x] "y") could be
+        ;; reduced to (cat "fg" expr "xy")
         {:type :string, :value (apply str (map :value (:args cat-op)))}
         (= 1 (count (:args cat-op)))
         (first (:args cat-op))

  "Reduces an `or` whenever possible."
  [or-op]
  (cond (every? #(= :char-set (:type %)) (:args or-op))
        {:type :char-set,
         :value (apply set/union (map :value (:args or-op)))}
        (= 1 (count (:args or-op)))

        cat-op))

(defn- flatten-or
  "Flattens an `or` inside an `or`, whenever possible."
  [or-op]
  (assoc or-op
    :args (->> (:args or-op)
