简体   繁体   English

Clojure遍历哈希映射列表

[英]Clojure Iterating over a list of hash maps

I get an error "Don't know how to create ISeq from" from the following code. 我从以下代码中收到错误消息“不知道如何创建ISeq”。 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. hash-map-list是一个函数。 It isn't a list of hash-maps. 它不是哈希映射列表。 If you call the function, your code will work. 如果调用该函数,您的代码将起作用。

(first (hash-map-list))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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