Skip to content

Instantly share code, notes, and snippets.

@dzzzchhh
Last active June 9, 2022 09:14
Show Gist options
  • Save dzzzchhh/44ff78245e8656ef39e3679ea0cb4935 to your computer and use it in GitHub Desktop.
Save dzzzchhh/44ff78245e8656ef39e3679ea0cb4935 to your computer and use it in GitHub Desktop.
The most naive way of solving this problem by a person who is super new to Closure, but I did get joy from solving this nonetheless :)
(defn first-reccurring-character
([string-sequence] (first-reccurring-character string-sequence #{}))
([string-sequence lookup]
(let [current-character (first string-sequence)]
(if (contains? lookup current-character)
current-character
(recur (rest string-sequence) (conj lookup current-character))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment