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 "aeiou") | |
(defn is-vowel [ch] (not (nil? (some #{ch} vowels)))) | |
(defn abs [n] (max n (- n))) | |
(defn distance | |
"Returns the distance from the number x to the closest number in xs" | |
[xs x] | |
(apply min (map (fn [y] (abs (- y x))) xs))) |
OlderNewer