Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 624981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:15:35+00:00 2026-05-13T19:15:35+00:00

What is the rationale for Symbols in Clojure to be bound to an underlying

  • 0

What is the rationale for Symbols in Clojure to be bound to an underlying object and have an optional separate value ? Perhaps something elementary I am missing but would be great if someone could point out the Why.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:15:35+00:00Added an answer on May 13, 2026 at 7:15 pm

    General intro:

    Symbols in any Lisp are used as identifiers. If you’re going to refer to the value of a variable, say, you need to have a way of naming it; that’s what symbols are for. Remember that all Lisp code gets translated at read time to Lisp data structures; identifiers must also be represented by some data structure and it happens to be the symbol. Upon encountering a symbol, eval dispatches to some kind of a “name lookup” operation.

    Moving from Lisp generalities to Clojure particulars, the behaviour of the Clojure eval / compiler is that upon encountering a symbol, it takes it to be a name for either a let-introduced local variable or function parameter or the name of an entry in a namespace. Actually only non-namespace-qualified symbols may be used in the first capacity (meaning symbols of the form foo and not some-namespace/foo).

    A roughly sketched example:

    For a non-namespace-qualified symbol foo, if a let binding / function parameter of name foo is found, the symbol evaluates to its value. If not, the symbol gets transformed to the form *ns*/foo (*ns* denotes the current namespace) and an attempt is made to look up a curresponding entry in *ns*; if there is such an entry, its value is returned, if not, an exception is thrown.

    Note that a symbol like identity, when used in namespace quux, will be resolved to clojure.core/identity through an intermediate step in which an entry under quux/identity is discovered; this will normally refer to clojure.core/identity. That’s an implementation detail one doesn’t think of when coding intuitively, but which I find impossible not to mention when trying to explain this.

    A symbol which is already namespace-qualified (something like a zip/root in a namespace which refers to clojure.zip without use‘ing it) will be looked up in the appropriate namespace.

    There’s some added complexity with macros (which can only occur in operator position), but it’s not really something relevant to the behaviour of symbols themselves.

    Vars vs Symbols:

    Note that in Clojure, symbols are not themselves storage locations — Vars are. So when I say in the above that a symbol gets looked up in a namespace, what I mean is that eval looks up the Var named by the symbol resolved to its namespace-qualified form and then takes the value of that. The special form var (often abbreviated to #') modifies this behaviour so that the Var object itself is returned. The mechanics of symbol-to-Var resolution are unchanged, though.

    Closing remarks:

    Note that all this means that symbols are only “bound” to objects in the sense that eval, when evaluating a symbol, goes on to look for some further object. The symbol itself has no “slot” or “field” for an object to be bound to it; any impression that a symbol is “bound” to some object is due to eval‘s workings. This is a Clojure characteristic, as in some Lisps symbols do themselves act as storage locations.

    Finally, one can use the usual quoting mechanism to prevent the evaluation of a symbol: in 'foo, the symbol foo will not be evaluted (so no name lookup of any sort will be performed); it’ll be returned unchanged instead.

    In response to OP’s comment: Try this for fun:

    (defmacro symbol?? [x]
      (if (symbol? x)
        true
        false))
    
    (def s 1)
    (symbol? s)
    ; => false
    (symbol?? s)
    ; => true
    (symbol? 's)
    ; => true
    (symbol?? 's)
    ; => false
    

    The last one explained: 's is shorthand for (quote s); this is a list structure, not a symbol. A macro operates on its arguments passed in directly, without being evaluated; so in (symbol?? 's) it actually sees the (quote s) list structure, which is of course not itself a symbol — although when passed to eval, it would evaluate to one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the rationale behind the design decision to have separate namespaces for values
I have no idea what is the rationale behind naming the vdev (virtual devices)
What's the rationale (if any) of using XamlWriter.Save() to serialize a domain object? Please
I am wondering what the rationale is behind having Java's Map.put(key, value) method overwrite
What's the rationale of Koenig lookup? Cannot avoid thinking of it like something that
Possible Duplicate: Java: Rationale of the Object class not being declared abstract Why is
The rationale: HQL and NH criteria are NHibernate specific constructs and as such they
What is the rationale of not providing no-arg constructors in Wrapper Classes? I know
PLT Scheme 's documentation says: The rationale for providing print is that display and
I'm wondering if anyone has a rationale for why web development plugins for browsers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.