Skip to content

Instantly share code, notes, and snippets.

@mwfogleman
Created August 25, 2014 18:17
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 mwfogleman/618fe009952d7c544857 to your computer and use it in GitHub Desktop.
Save mwfogleman/618fe009952d7c544857 to your computer and use it in GitHub Desktop.
anagram?
(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
@mwfogleman
Copy link
Author

A hat tip to Douglas Hofstadter!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment