Skip to content

Instantly share code, notes, and snippets.

@oranenj
Created November 24, 2009 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oranenj/242063 to your computer and use it in GitHub Desktop.
Save oranenj/242063 to your computer and use it in GitHub Desktop.
(defn squeeze-transient [string character]
(apply str
(persistent!
(reduce
(fn [x y]
(if (and (= (nth x 0 nil) character)
(= y character))
x
(conj! x y)))
(transient []) (seq string)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment