Hi,

On Aug 4, 9:32 am, limux <liumengji...@gmail.com> wrote:

> i very confused var-quote, hope someone explain it more detailed than
> the clojure.org's, thks.

Global values are stored in so-called Vars. Symbols are used in
program code to link to those Vars, ie. to basically give them a name.
So the addition function is stored in a Var named +. So whenever the
compiler sees the symbol + it looks up the Var + refers to and gets
its value, the actual addition function. Now, if you actually want to
access the Var itself, not the function it holds, you need to somehow
tell the compiler this intent. And this is exactly what #' does. When
you write #'+ in your code, you tell the compiler: "Look. I want the
Var named +, not its contents."

This is useful to extract metadata about the value in the function,
like docstrings, argument lists, type hints, etc.

Hope this helps.

Sincerely
Meikel

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