Thanks for the info -

The macro in question was in a library I was using... I just ended up
writing a function to build a data structure that did exactly what I needed.

First hand lesson that data structures > functions > macros

Thanks,

Jason Lewis

Email          jasonlewi...@gmail.com

Twitter        @canweriotnow <http://twitter.com/canweriotnow>

Blog           http://decomplecting.org

About         http://about.me/jason.lewis


On Fri, Feb 15, 2013 at 11:15 AM, Phillip Lord <phillip.l...@newcastle.ac.uk
> wrote:

>
>
> The obvious answer is use a function and not a macro. So, for instance....
>
> user> (defn f[x] (println x))
> #'user/f
> user> (f [1 2 3])
> [1 2 3]
> nil
> user> (def x [1 2 3])
> #'user/x
> user> (f x)
> [1 2 3]
> nil
>
> In this case, the arguments are evaluated before being passed. x evals
> to [1 2 3] while [1 2 3] evals to itself.
>
> What circumstances do you want the argument to *not* be evaled? Unless
> there is one, why use a macro?
>
> Phil
>
>
> Jason Lewis <jasonlewi...@gmail.com> writes:
>
> > Hey, Clojure n00b here... I'm working with a macro that expects a vector
> > and iterates over the contents with a `for` form. I had naively assumed
> > that it would work equally well to pass it a var containing the vector,
> but
> > instead it tries to iterate over the individual symbol and the output is
> > munged.
> >
> > I also tried passing the fn call that I was using to build the vector,
> with
> > no better results. Is there any way to force evaluation so the macro
> 'sees'
> > the vector it expects instead of trying to work on the symbol or form
> that
> > I pass it?
> >
>
> --
> --
> 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/groups/opt_out.
>
>
>

-- 
-- 
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/groups/opt_out.


Reply via email to