Re: Idiomatic record construction in 1.3

2011-10-26 Thread Aaron Bedra
On 10/26/2011 05:50 AM, Chas Emerick wrote: Certainly are in ours: http://shop.oreilly.com/product/0636920013754.do I'm sure they're mentioned in Programming Clojure 2ed as well. Yes, they will be in Programming Clojure 2ed Cheers, Aaron Bedra -- Clojure/core http://clojure.com -- You receiv

Re: Idiomatic record construction in 1.3

2011-10-26 Thread Alex Miller
Fogus confirmed it is intended and will reply when he gets a chance. I'm starting to see why - the values are read as literals and so forms are read as literals and not evaluated. I expect many people will find this behavior surprising on first encounter... On Oct 26, 8:55 am, Chouser wrote: > I

Re: Idiomatic record construction in 1.3

2011-10-26 Thread Alex Miller
I should also mention that the reader form is not record-specific - it works on any Java object: user=> #java.util.Date[1319639275929] # user=> #java.lang.String["abcdef"] "abcdef" user=> #java.awt.Point[1 2] # On Oct 26, 8:24 am, Alex Miller wrote: > I need to correct that p2 and m1 should not

Re: Idiomatic record construction in 1.3

2011-10-26 Thread Chouser
On Wed, Oct 26, 2011 at 9:24 AM, Alex Miller wrote: > I need to correct that p2 and m1 should not have parens around > them sorry about that.  Seemed obvious when I read it again this > morning. > > The literal reader forms are even trickier in how they treat embedded > expressions.  They seem

Re: Idiomatic record construction in 1.3

2011-10-26 Thread Alex Miller
I need to correct that p2 and m1 should not have parens around them sorry about that. Seemed obvious when I read it again this morning. The literal reader forms are even trickier in how they treat embedded expressions. They seem to preserve (and not evaluate) the quoted forms? user=> (def p

Re: Idiomatic record construction in 1.3

2011-10-26 Thread Chas Emerick
Certainly are in ours: http://shop.oreilly.com/product/0636920013754.do I'm sure they're mentioned in Programming Clojure 2ed as well. - Chas On Oct 26, 2011, at 5:10 AM, Shantanu Kumar wrote: > Does anybody know if these changes are going to be covered in the > newer Clojure books/editions? >

Re: Idiomatic record construction in 1.3

2011-10-26 Thread Shantanu Kumar
Does anybody know if these changes are going to be covered in the newer Clojure books/editions? Regards, Shantanu On Oct 26, 12:02 pm, David Powell wrote: > Also, the factory fns are available when you require/use the relevant > namespace, so the client doesn't have to use import as well. > > --

Re: Idiomatic record construction in 1.3

2011-10-26 Thread David Powell
Also, the factory fns are available when you require/use the relevant namespace, so the client doesn't have to use import as well. -- Dave -- 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

Re: Idiomatic record construction in 1.3

2011-10-25 Thread Colin Jones
+1 A further argument in favor of your choices is that p3 and m2 both work great with higher-order fns, which I didn't immediately find a way to do with any of the others: user=> (map (partial apply ->Person) [["bob" "loblaw"] ["stan" "sitwell"]]) (#user.Person{:first "bob", :last "loblaw"} #us

Idiomatic record construction in 1.3

2011-10-25 Thread Alex Miller
So I'm catching up with the 1.3 defrecord additions (best docs here afaik: http://dev.clojure.org/display/design/defrecord+improvements - will http://clojure.org/datatypes be updated?) In 1.2, records were constructed only with the positional Java constructor: (defrecord Person [first last]) (