FWIW, I use:
- (->Book "Lord of the Rings", "Tolkien")
- when I define the record instance with the default fields, and the
number of default fields is a small number
- (map->Book {:title "The Fellowship of the Ring",
:author "Tolkien",
On 4/9/14, 12:51 PM, Anthony Ortiz wrote:
I see that there are several ways of instantiating a record :
(->Book "Lord of the Rings", "Tolkien")
(Book. "Lord of the Rings", "Tolkien")
#user.Book{:title "Lord of the Rings", :author "Tolkien"}
You missed one:
(map->Book {:title "Lord of the R
You can refer-in the first (factory function) to another namespace; for the
second you'd have to import the class. I prefer the first. The third is
special syntax for the reader.
As to the last question, I don't know, but it allows you to define your
own. For example,
(defrecord Book [tit
I see that there are several ways of instantiating a record :
(->Book "Lord of the Rings", "Tolkien")
(Book. "Lord of the Rings", "Tolkien")
#user.Book{:title "Lord of the Rings", :author "Tolkien"}
Questions :
1) The second version is referred to as the "original" version so I'm
wondering w