larry google groups <lawrencecloj...@gmail.com> writes:

> We put some data in this atom. And then we output it. But I have had
> great difficulty getting anything to appear on the screen. Assuming
> the problem was with the fact the main sequence was lazy, I added in
> doall everywhere it made sense. But I still can not get anything to
> work:

Your problem's here and has nothing to do with lazyness:

>           (let [inner-details (second each-user-map)]
>              (assoc final-map-for-output "username" (get inner-details 
> "username" "nothing found for user"))
>              (assoc final-map-for-output "updated" (get inner-details 
> "updated" "nothing found for updated"))
>              final-map-for-output)))

assoc (and all clojure collection functions) doesn't modify the given
map but it returns a new version of the given map with the new
association.  You simply don't use it.

Maybe you want something like this in case you want to output pairs of
"username"/inner-details, and "updated"/inner-details pairs.

--8<---------------cut here---------------start------------->8---
(defn current-users [request]
  "The default action of this app. Add new users to the registry, and
delete the ones that are more than 15 seconds old"
  (let [this-users-params (:params request)]
    (add-to-logged-in-registry this-users-params)
    (remove-old-registrants)
    (response (apply str
                     (mapcat
                      (fn [each-user-map]
                        (let [inner-details (second each-user-map)]
                          [["username" (get inner-details "username"
                                            "nothing found for user")]
                           ["updated" (get inner-details "updated"
                                           "nothing found for updated")]]))
                      @registry)))))
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo

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