Hi Steve!
that last post makes it clear for me.
The example using "let" shows exactly what I needed to understand.
Thanks very much!
Arie
2008/10/6 Stephen C. Gilardi <[EMAIL PROTECTED]>
>
>
> On Oct 6, 2008, at 9:07 AM, hotcore wrote:
>
> > I was playing around with data structures and found that I couldn't
> > type:
> > (conj #{aap noot mies} 'wim)
> > which results in:
> > java.lang.Exception: Unable to resolve symbol: mies in this context
> >
> > Instead I have to type:
> > (conj '#{aap noot mies} 'wim)
> > or:
> > (conj (set '(aap noot mies)) 'wim)
> >
> > I wonder why the quote is needed. Normally the quote is only used to
> > prevent the first item of a list being interpreted as a (special)
> > operator / function; but that's not the case here. Or is it?
>
> In addition to literal lists, symbols also evaluate to something other
> than themselves. Without a quote:
>
> - a list evaluates to the result of a function call
>
> - a symbol is first "resolved" to identify a let-bound name or a var
> that it represents and evaluates to the value bound to that name or var.
>
> The error message you got is describing the latter case.
>
> The line you typed:
>
> > (conj #{aap noot mies} 'wim)
>
>
> is not meaningless--it just isn't the correct way to express what you
> wanted.
>
> Here's a context where it would have been accepted:
>
> user=> (let [aap 1 noot 2 mies 3]
> (conj #{aap noot mies} 'wim))
> #{1 2 3 wim}
> user=>
>
> In addition to these:
>
> > Instead I have to type:
> > (conj '#{aap noot mies} 'wim)
> > or:
> > (conj (set '(aap noot mies)) 'wim)
>
>
> You could have also typed:
>
> (conj #{'aap 'noot 'mies} 'wim)
>
> Which makes it clear that it's symbol evaluation that you're
> suppressing with the quotes.
>
> --Steve
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---