Imagine I have a string which I want to transform as follows:
- Remove all spaces.
- Remove all dots.
- Make the string lower-case.
One way to do it is this:
(defn my-function
[s]
(let
[
clean-string1 (clojure.string/replace s " " "")
clean-string2 (clojure.string/replace clean-string1 "." "")
clean-string3 (clojure.string/lower-case clean-string2)
]
;; ...
)
)
How can I "chain" the functions clojure.string/replace and clojure.string/lower-case so that
- the output of
(clojure.string/replace s " " "")is fed to the input of (clojure.string/replace clean-string1 "." "")and its output is fed to the input of(clojure.string/lower-case clean-string2)
so that I don't need intermediate variables clean-string1 and clean-string2?