conj can surely produce maps, and does so happily in the following cases:
(conj {} [:foo :bar])
(conj {} {:foo :bar})
I suggesting adding printlns or logging or a debugger and checking the
value of this-users-params, it is almost certainly not what you expect
it to be.
as a side note creating a date object just to call getTime is kind of
gross, try (System/currentTimeMillis)
On Fri, Oct 19, 2012 at 12:42 AM, Sean Corfield <[email protected]> wrote:
> On Fri, Oct 19, 2012 at 12:10 AM, larry google groups
> <[email protected]> wrote:
>>
>> (defn add-to-logged-in-registry [this-users-params]
>> (let [right-now (. (Date.) getTime)
>> new-user-entry (conj this-users-params { "updated" right-now })]
>> (if (:username new-user-entry)
>> (swap! registry assoc (:username new-user-entry) new-user-entry))))
>>
>> The if statement seems to never be true.
>
>
> conj produces a sequence, not a map, so the lookup of :username fails. Try
> new-user-entry (assoc this-users-params "updated" right-now)
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>
> --
> 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
--
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?
--
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