Reverse a string
For example: input: "cool" output: "looc"
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
(ns reverse-string-test (:require [clojure.test :refer [deftest is]] reverse-string)) (deftest empty-string-test (is (= "" (reverse-string/reverse-string "")))) (deftest a-word-test (is (= "tobor" (reverse-string/reverse-string "robot")))) (deftest capitalised-word-test (is (= "nemaR" (reverse-string/reverse-string "Ramen")))) (deftest sentence-with-punctuation-test (is (= "!yrgnuh m'I" (reverse-string/reverse-string "I'm hungry!")))) (deftest palindrome-test (is (= "racecar" (reverse-string/reverse-string "racecar"))))
(ns reverse-string) (defn reverse-string [s] (clojure.string/reverse s))
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.