For one, the type of a record is not as malleable as the other attributes of
the record. It's less dynamic.
2011/2/18 Base
> Thank you Stuart! This makes perfect sense and is quite elegant.
>
> So is performance the only compelling reason to do this? I am assuming
> there are times that maps ar
On Fri, Feb 18, 2011 at 5:31 PM, Base wrote:
> Are there some things that you can do with maps that you cannot do
> with defrecord?
Round-trip them through prn/read without them turning into something else.
--
You received this message because you are subscribed to the Google
Groups "Clojure" g
Thank you Stuart! This makes perfect sense and is quite elegant.
So is performance the only compelling reason to do this? I am assuming
there are times that maps are 'good enough', but would you say that if
you ever have a defined data structure you would advise to use
defrecord to gain this incr
Hi Base,
It's easy, because instances of defrecord behave identically to maps. Say
you have a lot of "person" records that look like this:
{:first-name "Stuart", :last-name "Sierra", :location "NYC"}
You might write a constructor function to create these maps:
(defn person [& options]
Hi Stuart -
I am very much still learning Clojure and havent waded into defrecord,
etc.
Could you provide an example of how you wold start with a map and
shift to a defrecord in the future?
Thanks
Base
On Feb 18, 11:16 am, Stuart Sierra
wrote:
> One purpose of defrecord was to be interchangea
One purpose of defrecord was to be interchangeable with maps, so that you
can prototype with maps, then switch to defrecord for better performance
without changing much code. If you use constructor functions to create
instances of your records/maps, you hardly have to change anything at all.
A
>
> Do you have more details of this - it sounds interesting...
>
A very rough answer: https://github.com/ossareh/clj-boilerplate
I've some local changes that will go up in a few days that make this
"better" - they're based off me actually using the framework where as what
is there right now is m
On Feb 16, 6:07 pm, Michael Ossareh wrote:
> One place it has mattered is in using compojure with ring. I'm building a
> few middlewares that permit my applications to have a good sense of
> structure (somewhat MVC ish) in that process I discovered that to be
> compojure compatible you must return
On Wed, Feb 16, 2011 at 1:23 AM, Sunil S Nandihalli <
sunil.nandiha...@gmail.com> wrote:
> Just thinking out loud...
> After listening to "classes are a premature optimization" lecture on infoQ
> .. I was just wondering if the only purpose of defrecord is space&speed
> efficiency ... and could jus
One place it has mattered is in using compojure with ring. I'm building a
few middlewares that permit my applications to have a good sense of
structure (somewhat MVC ish) in that process I discovered that to be
compojure compatible you must return a supported type or extend the
Renderable protocol.
2011/2/16 Sunil S Nandihalli
> Just thinking out loud...
> After listening to "classes are a premature optimization" lecture on infoQ
> .. I was just wondering if the only purpose of defrecord is space&speed
> efficiency ... and could just use maps .. ofcourse .. I won't be able to use
> the prot
Thanks Michael.
yea true .. but I don't think I will miss them much .. :)
Sunil.
On Wed, Feb 16, 2011 at 12:32 PM, Michael Ossareh wrote:
> Am I missing something?
>>
>
> types.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to thi
>
> Am I missing something?
>
types.
--
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 unsubscrib
13 matches
Mail list logo