Hi Ruben,

What you are missing is that map is the wrong function to use here. Map is 
lazy, and combining map with something side-effecty like println will lead to 
confusion.

doseq will give you what you want.

Stu

Stuart Halloway
Clojure/core
http://clojure.com

> Hi all,
> 
> when I execute the following code:
> 
> (def users (ref []))
> 
> ;works
> (defn print-users []
>  (with-query-results res ["select id,username,password from users" ]
> 
>        (dorun
>               (dosync (ref-set users  res )  )
>       )
>  )
> )
> 
> 
> and then execute (map #(println %) @users)  i get back this:
> 
> ({:id 1, :username rpierich, :password test}
> {:id 2, :username ruthpierich, :password test}
> nil {:id 3, :username ruthpierich, :password test}
> nil nil)
> 
> when i perform a @users i get:
> 
> ({:id 1, :username "rpierich", :password "test"} {:id 2, :username
> "ruthpierich", :password "test"} {:id 3, :username
> "ruthpierich", :password "test"})
> 
> 
> Is this a bug with map or since it adds on those nils or am i missing
> something in the call to map?
> 
> Cheers,
> Ruben
> 
> -- 
> 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




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