I have a function that returns a struct that has two fields, :key :event. The :event field is a map (decomposed Java object retrieved from a cache). In the REPL, I see the return value as a map.
I then apply, (def events (map #(make-event %) (keys events-cache)))
, applying the make-event function for each key from the cache, and want a map back containing each event map keyed by key.
What I get back is that, but inside a list. So calling any map functions, to search etc., throws an error, clojure.lang.LazySeq cannot be cast to clojure.lang.IFn.
I'm sure I'm thinking about this all wrong, but is there a way to pull the map of maps from the list?
Maybe this is what you want?
(into {} (for [k (keys events-cache)]
[k (make-event k)]))
Your terms are vague, and the error message you post suggests the issue is of a very different sort than the question you're asking. You're likely to get more help if you post some code, and especially a real stacktrace.
But in general, this error message says "You have a lazy seq object that you are trying to call as a function", like:
(let [m1 (map some-function whatever)
m2 (...more stuff...)]
(m1 m2))
If you want to return a two-element list of m1
and m2
, rather than calling m1
as a function with m2
as an argument, you want to use the list
function:
(list m1 m2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With