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
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
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 —
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
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#]]
> {
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#))})