/gist:91eb3e13c66062fc7585 Secret
Last active
August 29, 2015 13:56
-
-
Save llasram/91eb3e13c66062fc7585 to your computer and use it in GitHub Desktop.
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 my-stuff.core | |
(:require [clojure.string :as str])) | |
(defn anagram? | |
[word word'] | |
(let [letter? #(Character/isLetter %) | |
letters #(->> % str/lower-case (filter letter?) set)] | |
(= (letters word) (letters word')))) | |
(defn -main | |
[& args] | |
(if (not= (count args) 2) | |
(println "Usage: <first word> <second word>") | |
(if (anagram? (first args) (second args)) | |
(println "Anagram") | |
(println "Not an anagram")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment