Skip to content

Instantly share code, notes, and snippets.

@francoisdevlin
Created August 22, 2009 12:50
Show Gist options
  • Save francoisdevlin/172772 to your computer and use it in GitHub Desktop.
Save francoisdevlin/172772 to your computer and use it in GitHub Desktop.
(defn vreplace
([s p r] (replace s p r))
([s p r & more]
(let [pair (take 2 more)
next-p (first pair)
next-r (second pair)
remaining (drop 2 more)]
(if next-r
(replace (replace s next-p next-r remaining) p r)
(replace s p r)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment