Last active
July 20, 2023 15:52
-
-
Save chase-lambert/8c570cffa63f9ff86d2c7260dad7d3ec to your computer and use it in GitHub Desktop.
rendezvous with cassidoo challenge: 23-07-16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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