What causes “java.lang.IllegalArgumentException: No value supplied for key”?

≡放荡痞女 提交于 2019-12-23 19:53:05

问题


I have code of the shape

(let [{foo :foo} (make-foo)] ...)

This code occasionally emits a java.lang.IllegalArgumentException: No value supplied for key: {:foo "foo" :other "other"}.

I've seen Clojure : "java.lang.IllegalArgumentException: No value supplied for key:" when I changed require, however I haven't changed the require of my program since it last worked.

What are the possible causes for the "No value supplied for key" exception?


回答1:


This happens when you try to create a map from an odd number of key/value entries: the last key is missing a value. One way this can happen is when destructuring a non-map collection but treating it as a map, since this implicitly creates a map from the collection for you before destructuring it as an ordinary map.



来源:https://stackoverflow.com/questions/47037220/what-causes-java-lang-illegalargumentexception-no-value-supplied-for-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!