Skip to content

Instantly share code, notes, and snippets.

@tychobrailleur
Created March 11, 2020 09:27
Show Gist options
  • Save tychobrailleur/e183cd3accfe5f9aa2bb1bf0fa57cfd8 to your computer and use it in GitHub Desktop.
Save tychobrailleur/e183cd3accfe5f9aa2bb1bf0fa57cfd8 to your computer and use it in GitHub Desktop.
(require 'clojure.string)
(defn remove-last-vowel [word]
(-> word
clojure.string/reverse
(clojure.string/replace-first #"[aeiouy]" "")
clojure.string/reverse))
(defn remove-last-vowels [sentence]
(->> (clojure.string/split sentence #" ")
(map remove-last-vowel)
(clojure.string/join " ")))
(println (remove-last-vowels "Hi, there!"))
(println (remove-last-vowels "This is not a test."))
(println (remove-last-vowels "Hippopotamus"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment