The convention that I've seen among the Clojure community is to represent these kinds of things as data structures, and define your contraints using something like https://github.com/plumatic/schema
On Friday, April 29, 2016 at 1:10:29 PM UTC-5, Olek wrote: > > Hi! > > Clojure data structures can express tree data structures, same as in XML > what is ideal for DSL. Especially that thanks to macros you can also change > the evaluation order and hide execution complexity and treat DSL in terms > of declarations and not statements nor functions. What is more the grammar > of such structure is simplified to what you can see in XML. > For example let take the XML example: > > <books> > <book iban="31232" title="some title" author="some author"/> > <book iban="43232" title="another title 2" author="another author 2"/> > </books> > > Now lets look at Clojure: > > (books > (book { :iban "31232" :title "some title" :author "some author" }) > (book { :ban "43232" :title "another title2" :author "another author 2" > }) ) > > You can notice that when you build macros & functions for that you have > simple structure of input arguments like: > > (defmacro/defn books[ attrs & books-col ] > (do some stuff)) > > (defn book[ attrs ] > (do some stuff)) > > Now all you need is to slurp the specification made in terms of created > DSL, call eval on it and as the result of execution you will spit the > resulting data/mutate the state/do side effect. > Finally for XML you can create XSD to constraint possibilities of tags > which can be put into DSL. > But as you can see, such possibility is missing for Clojure. Do you have > any ready tool for that or do I have to create one? > > Thanks in advance, > Olek > > > > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.