Last active
August 29, 2015 14:06
-
-
Save mwfogleman/71f675d03734212da981 to your computer and use it in GitHub Desktop.
"Ee' e i:", "Hr's th gst:"
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
(def vowels "aeiouyAEIOUY") | |
(def consonants "bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ") | |
(defn alph-filter [sub srn] (clojure.string/capitalize (apply str (remove (set sub) srn)))) | |
(defn self-alph-filter [sub srn] (alph-filter sub (concat "This " srn))) | |
(def init-one "sentence contains no consonants and the following sentence no vowels.") | |
(def init-two "sentence contains no vowels and the preceding sentence no consonants.") | |
(= (self-alph-filter consonants init-one) | |
"I eee oai o ooa a e ooi eee o oe.") | |
;; => true | |
(= (self-alph-filter vowels init-two) | |
"Ths sntnc cntns n vwls nd th prcdng sntnc n cnsnnts.") | |
;; => true | |
;; EE I I!: | |
(self-alph-filter consonants init-one) | |
(self-alph-filter vowels init-two) | |
;; THR SH BLWS! | |
(some (set consonants) (self-alph-filter consonants init-one)) ; => nil | |
(some (set vowels) (self-alph-filter vowels init-two)) ; => nil | |
(= (clojure.set/intersection | |
(set "Ee' e i:") | |
(set "Hr's th gst:")) | |
#{\space \' \:}) | |
;; => true | |
(= (clojure.set/intersection | |
(set (alph-filter "': " "Ee' e i:")) | |
(set (alph-filter "': " "Hr's th gst:"))) | |
#{}) | |
;; => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment