On Mon, Jul 6, 2009 at 3:47 PM, Sean Devlin<francoisdev...@gmail.com> wrote:
>
> I think your unquote is okay.  ClojureQL does something similar.
>
> However, my gut says this should be in a doseq, not a for statement.
> Could be totally wrong, tough.

I think the OP is trying to build and return a list, not
trying to execute a series of operations.  If I'm right,
then 'for' is better than 'doseq'.

> On Jul 6, 2:39 pm, Mike <cki...@gmail.com> wrote:
>> Newbie question here.  Probably answered in Stu's book, but I forgot
>> it at home today.
>>
>> is:
>>
>> (for [x [1 2 3]] `(some-symbol ~x))
>>
>> dangerous?  I mean, assuming that some-symbol is bound and all.  At
>> the REPL I get
>>
>> ((user/some-symbol 1) (user/some-symbol 2) (user/some-symbol 3))
>>
>> which is what I'm interested in getting, but somehow the fact that
>> "for" is a macro and I'm escaping x assuming it's there is
>> disconcerting.

I can't think of any way in which it's dangerous.  Is it
important to you that the symbol become fully-qualified?  If
so, then what you've got is fine -- are you writing a macro?

If some-symbol is not referring to a Var, though, it's more
likely you want a regular quote than a syntax quote, in
which case it may be more idiomatic to build a vector:

  (for [x [1 2 3]] ['some-symbol x])

Or if you really do need a list:

  (for [x [1 2 3]] (cons 'some-symbol (list x)))

--Chouser

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to