Last active
August 17, 2023 03:34
-
-
Save chase-lambert/8743bd35d7d871782e05a91b8c8124ee to your computer and use it in GitHub Desktop.
rendezvous with cassidoo challenge: 23-08-13
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
(ns faulty-keeb | |
(:require [clojure.test :refer [deftest is]])) | |
(defn faulty-keeb [s] | |
(let [vowels #{\a \e \i \o \u \A \E \I \O \U} | |
vowel? (fn [c] (vowels c))] | |
(reduce (fn [acc c] | |
(if (vowel? c) | |
(apply str (reverse acc)) | |
(str acc c))) | |
"" | |
s))) | |
(deftest faulty-keeb-test | |
(is (= "rtsng" (faulty-keeb "string"))) | |
(is (= "w hllrld!" (faulty-keeb "hello world!")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment