Re: A new lisper's question about a macro

2010-01-25 Thread joel r
On Mon, Jan 25, 2010 at 3:09 AM, ataggart wrote: > > (zipmap >  (map keyword (take-nth 2 ~params)) >  (map (comp var-get resolve) (take-nth 2 (next ~params > Neat :-) Thanks! - Joel Rosario. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To po

Re: A new lisper's question about a macro

2010-01-25 Thread joel r
On Mon, Jan 25, 2010 at 3:42 AM, Richard Newman wrote: >> The former is a lot clearer to read, as it uses standard Clojure >> datastructures. > > ... which offers other advantages beyond the human, such as > > (def page-names keys) > > user=> (page-names foobar) > (:page :posts :post) > > Power co

Re: A new lisper's question about a macro

2010-01-24 Thread Richard Newman
The former is a lot clearer to read, as it uses standard Clojure datastructures. ... which offers other advantages beyond the human, such as (def page-names keys) user=> (page-names foobar) (:page :posts :post) Power comes from algorithms × data structures, and hiding the data structures —

Re: A new lisper's question about a macro

2010-01-24 Thread James Reeves
On Jan 24, 5:05 pm, joel r wrote: > It's meant to be called like this: > (define-template some-template-name >   page some-function-1 >   posts some-function-2 >   post some-function-3) > > It defs a var called some-template-name bound to a map that looks like this: > {:page some-function-1 >   :p

Re: A new lisper's question about a macro

2010-01-24 Thread ataggart
On Jan 24, 9:05 am, joel r wrote: > Hi, > > I was wondering whether there was an elegant way to make this macro do > more work: > > (defmacro define-template [template-name & template-params] >   `(def ~template-name (apply merge (map (fn [[k# v#]] >                                             {

A new lisper's question about a macro

2010-01-24 Thread joel r
Hi, I was wondering whether there was an elegant way to make this macro do more work: (defmacro define-template [template-name & template-params] `(def ~template-name (apply merge (map (fn [[k# v#]] {(keyword k#) (var-get (resolve v#))})