On Thu, Jan 5, 2017 at 6:45 AM, Tianxiang Xiong <tianxiang.xi...@gmail.com> wrote:
> So clearly a check is also made *after* evaluating the key forms. I'm > just not sure why we need to check *before* evaluating the key forms. > Because Clojure is a lisp. Code is data. {(java.util.UUID/randomUUID) 1 (java.util.UUID/randomUUID) 2} is a map that is passed to the compiler for compilation/evaluation, it's not some special MapASTNode like it would be possible in heteroiconic languages. However this map has a duplicate key, so one value should be dropped *because it's a map* before even getting to the compiler (including macros). Mark's suggestion (array-map (java.util.UUID/randomUUID) 1 (java.util.UUID/randomUUID) 2) is the way to go. Or if you want to be hacky: => {(java.util.UUID/randomUUID) 1 (do (java.util.UUID/randomUUID)) 2 (do (do (java.util.UUID/randomUUID))) 3} {#uuid "670a2de7-7a67-4cfb-97c7-cc2c10a8d6f7" 1, #uuid "88bb875d-7830-4ee3-8a2f-d10075e9226b" 2, #uuid "e68b01a8-6442-4392-9d34-ff76efa6ae32" 3} hth, Christophe -- On Clojure http://clj-me.cgrand.net/ Clojure Programming http://clojurebook.com Training, Consulting & Contracting http://lambdanext.eu/ -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.