首先我想说的是我是clojure新手,其次我想问你如何遍历一个map并在一个table中显示所有元素?这是我所做的。这是我的地图-
(def kvote(assoc kvote (keyword kljuc){:id id :liga liga :dan dan :cas cas :domaciTim domaciTim :gostujuciTim gostujuciTim :par par :konacanIshod{:1 jedinica :x nerijeseno :2 dvojka}}))
我正在使用 cldwalker 表功能并做到了这一点......
(table [ ["liga" "dan" "cas" "id" "par" "1" "X" "2"] [(:liga(get kvote(keyword :101)))
(:dan(get kvote(keyword :101)))
(:cas(get kvote(keyword :101)))
(:id(get kvote(keyword :101)))
(:par(get kvote(keyword :101)))
(get-in kvote [:101 :konacanIshod :1])
(get-in kvote [:101 :konacanIshod :x])
(get-in kvote [:101 :konacanIshod :2])
]] )
结果是这样的......
+---------+---------+-------+-----+--------------------+-----+-----+---+
| liga | dan | cas | id | par | 1 | X | 2 |
+---------+---------+-------+-----+--------------------+-----+-----+---+
| Serie A | nedelja | 20:00 | 101 | Bologna - Cagliari | 1.5 | 2.3 | 4 |
+---------+---------+-------+-----+--------------------+-----+-----+---+
如何遍历地图并显示所有元素,而不仅仅是一个特定关键字?我可以以某种方式增加我的关键字值并像那样显示它吗?