Created
August 25, 2014 18:17
-
-
Save mwfogleman/618fe009952d7c544857 to your computer and use it in GitHub Desktop.
anagram?
This file contains hidden or 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
(defn anagram? | |
[s1 s2] | |
(let [c1 (clojure.string/lower-case s1) | |
c2 (clojure.string/lower-case s2)] | |
(and (= (count c1) (count c2)) | |
(= (set c1) (set c2))))) | |
(anagram? "Mathematical Games" "Metamagical Themas") | |
; => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A hat tip to Douglas Hofstadter!