Other Clojure solutions. (ns reverse-string)
(defn reverse-string [s]
(let [reversed-chars (into () s)] ;; https://clojuredocs.org/clojure.core/into
(apply str reversed-chars)))
Other Nim solutions. proc reverse*(s: string): string =
if s == "":
return s
var aux = s
for i in 0 .. high(s) div 2:
swap(aux[i], aux[high(aux) - i])
aux
Other Roc solutions. module [reverse]
import unicode.Grapheme
reverse : Str -> Str
reverse = \string ->
when Grapheme.split string is
Ok chars ->
chars |> List.reverse |> Str.joinWith ""
Err _ -> ""
Other Rust solutions. pub fn reverse(input: &str) -> String {
input.chars().rev().collect::<String>()
}