Determine if a word or phrase is an isogram.
An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times.
Examples of isograms:
The word isograms, however, is not an isogram, because the s repeats.
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
(ns isogram-test (:require [clojure.test :refer [deftest is]] isogram)) (deftest test-isograms (is (isogram/isogram? "duplicates")) (is (isogram/isogram? "subdermatoglyphic")) (is (isogram/isogram? "thumbscrew-japingly")) (is (isogram/isogram? "Hjelmqvist-Gryb-Zock-Pfund-Wax")) (is (isogram/isogram? "Heizölrückstoßabdämpfung")) (is (isogram/isogram? "Emily Jung Schwartzkopf"))) (deftest test-non-isograms (is (not (isogram/isogram? "eleven"))) (is (not (isogram/isogram? "Alphabet"))) (is (not (isogram/isogram? "the quick brown fox"))) (is (not (isogram/isogram? "éléphant"))))
(ns isogram) (defn isogram? [s] (->> s (clojure.string/lower-case) (filter #(Character/isLetter %)) (apply distinct?)))
A huge amount can be learnt from reading other people’s code. This is why we wanted to give exercism users the option of making their solutions public.
Here are some questions to help you reflect on this solution and learn the most from it.