I have some Javascript on a website that pings my Clojure app. My app adds
in the user info like this:
(defn add-to-logged-in-registry [this-users-params]
"We assume some user is looking at a site such as wpquestions.com and the
Javascript on that site is sending an Ajax request to this app, every 10
seconds, with a map of information about the user, which we need to store
in the registry."
(let [right-now (. (Date.) getTime)
new-user-entry (conj this-users-params { "updated" right-now })]
(swap! registry (fn [map-of-user-maps]
(assoc (assoc map-of-user-maps (get new-user-entry
"username" "anonymous") {}) (get new-user-entry "username" "anonymous")
new-user-entry)))))
I wanted to get a map inside of a map like this:
{:lawrence {:last_name "Krubner", :image "ziggy_stardust.jpg", :username
"lawrence", :first_name "Lawrence", "updated" 1350568598742}}
instead I get:
{nil {:last_name "Krubner", :image "ziggy_stardust.jpg", :username
"lawrence", :first_name "Lawrence", "updated" 1350568598742}}
How can I get the username as the top level key, instead of "nil"?
--
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