Skip to content

Instantly share code, notes, and snippets.

@chase-lambert
Last active July 20, 2023 15:52
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 chase-lambert/8c570cffa63f9ff86d2c7260dad7d3ec to your computer and use it in GitHub Desktop.
Save chase-lambert/8c570cffa63f9ff86d2c7260dad7d3ec to your computer and use it in GitHub Desktop.
rendezvous with cassidoo challenge: 23-07-16
(ns explode-string
(:require
[clojure.string :as string]
[clojure.test :refer [deftest is]))
(defn explode-string [s]
(->> (group-by identity s)
vals
(map (partial apply str))
(remove string/blank?)
sort
(into [])))
(deftest explode-string-test
(is (= (explode-string "Ahh, abracadabra!")
["!" "," "A" "aaaaa" "bb" "c" "d" "hh" "rr"]))
(is (= (explode-string "\\o/\\o/")
["//" "\\\\" "oo"])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment