Re: Declarative Data Models

2011-05-04 Thread David Jagoe
Hey Stuart, On 4 May 2011 00:19, Stuart Sierra the.stuart.sie...@gmail.com wrote: No. Clojure template (which I wrote) is a backwards way of doing macros. It happens to be useful in clojure.test, but nowhere else. Thanks that's good to know. While we're on the subject, I'm curious about

Re: Declarative Data Models

2011-05-04 Thread Stuart Sierra
apply-macro is a bad idea because it evaluates a macro at runtime. Macros are supposed to be evaluated at compile-time, so apply-macro breaks assumptions about how macros are supposed to work. It's basically a back door into `eval`, which is considered bad style in Lisp-like languages.

Re: Declarative Data Models

2011-05-03 Thread Stuart Sierra
No. Clojure template (which I wrote) is a backwards way of doing macros. It happens to be useful in clojure.test, but nowhere else. -Stuart S clojure.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Declarative Data Models

2011-05-02 Thread David Jagoe
Hi Ambrose, Thanks for the advice. I have already implemented my application using maps (defstruct) and busy evaluating whether I should switch to records. I like the idea of using records and protocols to help me to define strict abstractions and to do easy type dispatch. On the other hand I can

Re: Declarative Data Models

2011-05-02 Thread David Jagoe
Hey Paul, On 30 April 2011 20:27, Paul deGrandis paul.degran...@gmail.com wrote: I'm not exactly sure of your specific use case, but you should take a look at clojure.template.  It could be what you're looking for. http://clojuredocs.org/clojure_core/clojure.template Great, I will have a

Re: Declarative Data Models

2011-05-02 Thread David Jagoe
Hi Everyone, Background to my problem: I am developing a compojure application, and there is lots of duplication in listing field names in my current data model: (i) in the defstruct (ii) in the public constructor's argument list (iii) in the hiccup form fields (iv) in the compojure argument

Re: Declarative Data Models

2011-05-02 Thread craig worrall
On May 2, 8:37 pm, David Jagoe davidja...@gmail.com wrote: (i) Is it possible to generate the (defrecord Person ...) from the person-entity hash-map that I have shown? Sure. You may want to have a look at https://gist.github.com/876029 (and associated post to this group) for something

Re: Declarative Data Models

2011-05-02 Thread Ken Wesson
On Mon, May 2, 2011 at 6:37 AM, David Jagoe davidja...@gmail.com wrote: Hi Everyone, Background to my problem: I am developing a compojure application, and there is lots of duplication in listing field names in my current data model: (i) in the defstruct (ii) in the public constructor's

Re: Declarative Data Models

2011-05-02 Thread Christian Schuhegger
My comment is unrelated to Clojure but related to the general topic of avoiding redundancy. Please have a look at InfoQ's Dan Haywood's Domain-Driven Design Using Naked Objects: http://www.infoq.com/articles/haywood-ddd-no The book is definitely worth a read! Naked Object's (now called Apache

Re: Declarative Data Models

2011-05-02 Thread Christian Schuhegger
Sorry, the link to their mailing list is here: http://mail-archives.apache.org/mod_mbox/incubator-isis-dev/201104.mbox/BANLkTim+9061Se1mPLK3=wymmj0qkdu...@mail.gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email

Re: Declarative Data Models

2011-05-02 Thread David Jagoe
On 2 May 2011 14:06, craig worrall craig.worr...@gmail.com wrote: On May 2, 8:37 pm, David Jagoe davidja...@gmail.com wrote: (i) Is it possible to generate the (defrecord Person ...) from the person-entity hash-map that I have shown? Sure. You may want to have a look at

Re: Declarative Data Models

2011-05-02 Thread David Jagoe
Hi Ken, Shoundn't be too hard. Something like [snip] Thanks, looks good. I haven't had a chance to play with the code yet but it looks like a very good start. You probably want it to omit bmi from the argument lists and compute it -- that will complicate things, something like: [snip]

Declarative Data Models

2011-04-30 Thread David Jagoe
G'day everyone, Are there any libraries or projects that are similar to Python Traits or Zope Schemas (http://pypi.python.org/pypi/zope.schema) for clojure. I am developing a compojure application and there is a lot of duplication between areas of the codebase, e.g. - Fields listed on the

Re: Declarative Data Models

2011-04-30 Thread Ambrose Bonnaire-Sergeant
Hi David, I can only comment on a subset of your post. Records can be cumbersome to work with during early stages of development, when everything is rather volatile (when isn't it?). You might like to try using maps instead. They are easier to work with when you are working out what properties

Re: Declarative Data Models

2011-04-30 Thread Paul deGrandis
I'm not exactly sure of your specific use case, but you should take a look at clojure.template. It could be what you're looking for. http://clojuredocs.org/clojure_core/clojure.template Paul On Apr 30, 3:39 am, Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com wrote: Hi David, I can