map in clojure giving unexpected result
1
Using map in clojure, checking whether a string contains uppercase character.
(map #(= (clojure.string/upper-case %) %) "Hello")
The expected result.
(true false false false false)
unfortunately, the result is unexpected.
(false false false false false)
I did an experiment when I replace "H" in the first "%", the result is still unexpected.
(map #(= (clojure.string/upper-case "H") %) "Hello")
(false false false false false)
When I replace "H" in the second "%", the result is changed, it is an expected result.
(map #(= (clojure.string/upper-case %) "H) "Hello")
(true false false false false)
What's wrong with that? Please feel free to comment.
dictionary clojure
(= (str/lower-case "Hello") "Hello")
should tell you whether your string was lowercased initially – customcommander Apr 23 at 10:02(= "H" \H)
which is false. – generateme Apr 23 at 10:12tupelo.chars
(cljdoc.org/d/tupelo/tupelo/21.04.13/api/tupelo.chars) andtupelo.string
(cljdoc.org/d/tupelo/tupelo/21.04.13/api/tupelo.string) – Alan Thompson Apr 23 at 15:16