2010/7/21 Ruben <ruben.pier...@gmail.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?
>
>
C'mon, did you really thing that such a bug could be there in map and seen
by nobody ? :-) There's more than one or two persons that use clojure, these
days :-D

The nils are the values of the map, the *return* values from the three
consecutive calls to println

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