I tried your code and got the expected result:

user> (def registry (atom {}))
#'user/registry
user> (import 'java.util.Date)
java.util.Date
user>   (defn add-to-logged-in-registry [this-users-params]
  (let [right-now (. (Date.) getTime)
        new-user-entry (conj this-users-params { "updated" right-now })]
    (swap! registry (fn [map-of-user-maps]
                     (conj map-of-user-maps {:hi new-user-entry})))))
#'user/add-to-logged-in-registry
user> (add-to-logged-in-registry {:a 1 :b 2})
{:hi {"updated" 1350573599595, :a 1, :b 2}}
user>

On Thu, Oct 18, 2012 at 8:16 AM, larry google groups <
lawrencecloj...@gmail.com> wrote:

> Okay, this is very confusing to me. If I try this:
>
>   (defn add-to-logged-in-registry [this-users-params]
>
>   (let [right-now (. (Date.) getTime)
>         new-user-entry (conj this-users-params { "updated" right-now })]
>     (swap! registry (fn [map-of-user-maps]
>                      (conj map-of-user-maps {:hi new-user-entry})))))
>
> and then at the REPL I:
>
> who-is-logged-in.core> @registry
> {nil {:last_name "777ch", :image "7777in.jpg", :username "7777ch",
> :first_name "77777alle", "updated" 1350573104214}}
>
> Here I am hard-coding a key called ":hi" and yet in the registry I still
> see the top level key as "nil". What happened to the :hi? I was expecting:
>
>
> {:hi {:last_name "777ch", :image "7777in.jpg", :username "7777ch",
> :first_name "77777alle", "updated" 1350573104214}}
>
>
> What am I not understanding?
>
>
>
>

-- 
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

Reply via email to