I like the way you use (partial list 'var).
On Thu, Nov 28, 2013 at 5:22 PM, juan.facorro wrote:
> Hi Curtis,
>
> The *apply* is unnecessary if you use *unquote-splice* (*~@*), also
> instead of the *into* and *for* usage you could just *map* over the list
> of symbols.
>
> Here's how I would do
Beautiful, thanks guys.
On Thursday, November 28, 2013 10:26:05 PM UTC-8, Alex Baranosky wrote:
>
> This also works, I believe:
>
> (defmacro migrate [& migration-syms]
> (let [migration-vars (for [sym migration-syms]
>`(var ~sym))]
> `(migrate* ~@migration-va
This also works, I believe:
(defmacro migrate [& migration-syms]
(let [migration-vars (for [sym migration-syms]
`(var ~sym))]
`(migrate* ~@migration-vars)))
On Thu, Nov 28, 2013 at 5:22 PM, juan.facorro wrote:
> Hi Curtis,
>
> The *apply* is unnecessary if y
Hi Curtis,
The *apply* is unnecessary if you use *unquote-splice* (*~@*), also instead
of the *into* and *for* usage you could just *map* over the list of symbols.
Here's how I would do it:
(defmacro migrate [& syms]
`(migrate* ~@(map (partial list 'var) syms)))
(macroexpand-1 '(migrate a b
I wrote a macro last night and got the feeling I did what I did in a
suboptimal way.
I have have a migration function that I stole from technomancy that takes
in the vars of migration functions:
(migrate #'create-db #'add-users-table #'etc)
It uses the name of the var from the metadata to reco