On Fri, 19 Nov 2010 17:52:03 -0800 (PST) Bob Shock <shock...@gmail.com> wrote:
> I had a bug in my code where I meant to type: > > (get map key) > > and instead typed: > > (get max key) > > It seems that any function name I put in for "max" always returns nil. > > user=> (get max 3) > nil > user=> (get min 3) > nil > user=> (get maxx 3) > java.lang.Exception: Unable to resolve symbol: maxx in this context > (NO_SOURCE_FILE:10) > user=> > > Any ideas? Yup. get returns nil if the key isn't in the map. Since functions aren't maps (or anything else that fits that abstraction), they can't contain the key, so you get nil. If you try it with pretty much any arbitrary map value (integers, etc.) you get nil. If you provide the third argument to get, you'll get that value back in all these cases. <mike -- Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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