Skip to content

Instantly share code, notes, and snippets.

View brettrowberry's full-sized avatar

Brett Rowberry brettrowberry

View GitHub Profile
(System/getProperty "user.dir")
@brettrowberry
brettrowberry / isogram.clj
Last active March 17, 2022 15:22
Function to detect isograms.
(defn isogram?
"An isogram is a word in which no letters occur more than once.
Empty string is considered an isogram in this implementation."
[^String s]
(boolean
(when (string? s)
(loop [letters (sort (seq s))]
(let [[current next & _] letters]
(cond
(nil? next) true