Assume data that looks like this: {ziri {:last_name ziri, :image ziggy_stardust.jpg, :username larry, :first_name larry, updated 1350626694791}, 7777erich {:last_name 77777ich, :image 77777ot_mein.jpg, :username 7777erich, :first_name 7777754545_halle, updated 1350626679436}}
When fed into the next function, the data looks like this: {:last_name 77777ich, :image 77777ot_mein.jpg, :username 7777erich, :first_name 7777754545_halle, updated 1350626679436} The function looks like this, but I can not get the if statement to ever run as if true. (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. I also tried: (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-not (nil? (:username new-user-entry)) (swap! registry assoc (:username new-user-entry) new-user-entry)))) and I tried this with "contains": (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 (contains? new-user-entry :username)) (swap! registry assoc (:username new-user-entry) new-user-entry)))) But it seems as if the branch following the if statement is never run, no matter what I do. Why? -- 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