This one took me a few minutes to see what I was doing wrong:
~~~
user=> (def m (atom {:x 1 :y 2}))
#'user/m
;; Later on ...
user=> (get m :x)
nil
;; What?? `:x` isn't a key in `m`? But I *know* it is...
;; Sanity check, for comparison:
user=> (get {:a 1 :b 2} :c) ; Right; `:c` is not a key in there, so I
get `nil`.
nil
;; Time passes and I eventually see the typo:
user=> (get @m :x)
1
~~~
Would be nice if that `(get m :x)` yielded an error message along the lines
of, "That's not a map, it's a reference to an atom containing a map."
-- John
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.