简体   繁体   中英

Clojure Iterating over a list of hash maps

I get an error "Don't know how to create ISeq from" from the following code. Can anyone tell me why this is not a proper sequence?

(defn hash-map-list []                                                                                                                 
  (map (fn [component]                                                                                                                 
      {:name component})                                                                                                            
      '("Jim" "Bill" "Carrie")))                                                                                                      

(first hash-map-list)

Thanks for your help

you simply forgot to call your function :)

(first (hash-map-list))
{:name "Jim"}

hash-map-list is a function. It isn't a list of hash-maps. If you call the function, your code will work.

(first (hash-map-list))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM