Let's take a look at what clojure.string/includes?
says it does and how it is implemented:
user=> (doc clojure.string/includes?)
-------------------------
clojure.string/includes?
([s substr])
True if s includes substr.
nil
user=> (source clojure.string/includes?)
(defn includes?
"True if s includes substr."
{:added "1.8"}
[^CharSequence s ^CharSequence substr]
(.contains (.toString s) substr))
nil
user=> (.toString (map :name [{:name "One"} {:name "Two"}]))
"clojure.lang.LazySeq@26e067"
user=> (.toString ["One" "Two"])
"[\"One\" \"Two\"]"
user=>
We see that it assumes its first argument is a string -- or more specifically a CharSequence
-- and it starts out by calling .toString
on that argument.
We see that (.toString (map .. ..))
produces a cryptic-looking string but this is because map
produces a lazy sequence and the default string representation of a lazy sequence is its type and a hex value, like any Java object that doesn't have a specific string representation.
However, calling .toString
on a quoted list or a vector produces a string representation of the elements of the list or vector.
Consequently, clojure.string/includes?
"works" in the latter case because even though you are not passing it a CharSequence
, when it converts the data structure to a string, it includes the name you are looking for.
Since you want to check if any element of the sequence contains the string, what you probably want here is:
(some #(clojure.string/includes? % "Joni") (map :name (mapify ..)))