Posts

Showing posts with the label clojure

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. ...