I modified procedure a bit to see interim results, and it's output confused me even more.
(defn replace-map "Replaces substrings in s from (keys m) by (vals m). " [s m] (loop [cur-str s, ks (keys m)] (if (empty? ks) cur-str (let [replaced (.replace s (first ks) (m (first ks)))] (println "STR BEFORE: " cur-str "; STR AFTER: " replaced) (recur replaced (rest ks)))))) You can see, that I changed it to work with keys and original map to reduce probability of a bug in a seq() method. Also I added println to see values of a str. Then I run: user> (replace-map "visual basic blablabla" my-rps) my-rps contains pair { "visual basic" "VB" }, so the target string must be "VB blablabla". But the output of procedure is: .... STR BEFORE: visual basic blablabla ; STR AFTER: visual basic blablabla STR BEFORE: visual basic blablabla ; STR AFTER: VB blablabla ;; ok, it is replaced ... STR BEFORE: VB blablabla ; STR AFTER: visual basic blablabla ;; and replaced back again! STR BEFORE: visual basic blablabla ; STR AFTER: visual basic blablabla Can anybody explain what's going on? I'm very very confused. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en