Ohh, ok that makes sense now. Thanks. On Jan 6, 1:01 pm, Meikel Brandmeyer <m...@kotka.de> wrote: > Hi, > > Am 06.01.2012 um 18:23 schrieb Chris McBride: > > > (defrecord Person [name address]) > > > (def bob (map->Person {:name "bob"})) > > > (prn (conj bob {:address "123 main st"})) ;#user.Person{:name > > "bob", :address "123 main st"} > > (prn (conj {:address "123 main st"} bob)) ;{:name "bob", :address > > nil} > > > The first print statement behaves how I would expect, the second one > > does not. Why wouldnt it fill the address field on the map? > > The address field on the record is nil. Hence it overwrites the address field > of the map. Think of merge. This has nothing to do with records. It's the > same with maps. > > user=> (conj {:a nil} {:a 1}) > {:a 1} > user=> (conj {:a 1} {:a nil}) > {:a nil} > > The fields in records are always there. Unlike maps where there are only the > keys you specified. > > user=> (map->Person {:name "Meikel"}) > #user.Person{:name "Meikel", :address nil} > > Hope this helps. > > Sincerely > Meikel
-- 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