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

  • Home
  • SEARCH
  • 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 295155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:25:57+00:00 2026-05-12T06:25:57+00:00

I have a symbol a bound to a function: (defn a [] (println Hello,

  • 0

I have a symbol "a" bound to a function:

(defn a []
    (println "Hello, World"))

user=> a
#<user$a__292 user$a__292@97eded>
user=> (a)    
Hello, World
nil

Then I use syntax-quote, it “resolves the symbol in the current context, yielding a fully-qualified symbol”, according to Clojure documentation. But why can’t I use it the same way as unqualified symbol?

user=> `a
user/a
user=> (`a)
java.lang.IllegalArgumentException: Wrong number of args passed to: Symbol (NO_SOURCE_FILE:0)

Second question: if I have a symbol in a list, why can’t I evaluate it the same way as if I would evaluate the symbol directly?

user=> (def l '(a 1 2))
#'user/l
user=> 'l
l
user=> (first l)
a
user=> ((first l))
java.lang.IllegalArgumentException: Wrong number of args passed to: Symbol (NO_SOURCE_FILE:0)

I have a suspicion I have a fatal flaw somewhere in the fundamental understanding of how symbols work here. What is wrong with above code?

  • 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-12T06:25:57+00:00Added an answer on May 12, 2026 at 6:25 am

    REPL = read eval print loop. Step through the read-eval process.

    READ: Clojure sees the string "(`a)", parses it and ends up with a data structure. At read time, reader macros are expanded and not much else happens. In this case, the reader expands the backquote and ends up with this:

    user> (read-string "(`a)")
    ((quote user/a))
    

    EVAL: Clojure tries to evaluate this object. Evaluation rules vary depending on what kind of object you’re looking at.

    • Some objects evaluate as themselves (numbers, strings, keywords etc.).
    • A Symbol is evaluated by resolving it in some namespace to obtain some value (usually).
    • A List is evaluated by macro-expanding the list until there are no macros left, then recursively evaluating the first item in the list to obtain some resulting value, then using the value of the first item in the list to decide what to do. If the first value is a special form, special stuff happens. Otherwise the first value is treated as a function and called with the values of the rest of the list (obtained by recursively evaluating all of the list’s items) as parameters.
    • etc.

    Refer to clojure.lang.Compiler/analyzeSeq in the Clojure source to see the evaluation rules for lists, or clojure.lang.Compiler/analyzeSymbol for symbols. There are lots of other evaluation rules there.

    Example

    Suppose you do this:

    user> (user/a)
    

    The REPL ends up doing this internally:

    user> (eval '(user/a))
    

    Clojure sees that you’re evaluating a list, so it evaluates all items in the list. The first (and only) item:

    user> (eval 'user/a)
    #<user$a__1811 user$a__1811@82c23d>
    

    a is not a special form and this list doesn’t need to be macroexpanded, so the symbol a is looked up in the namespace user and the resulting value here is an fn. So this fn is called.

    Your code

    But instead you have this:

    user> (eval '((quote user/a)))
    

    Clojure evaluates the first item in the list, which is itself a list.

    user> (eval '(quote user/a))
    user/a
    

    It evaluated the first item in this sub-list, quote, which is a special form, so special rules apply and it returns its argument (the Symbol a) un-evaluated.

    The symbol a is the value in this case as the fn was the value up above. So Clojure treats the Symbol itself as a function and calls it. In Clojure, anything that implements the Ifn interface is callable like an fn. It so happens that clojure.lang.Symbol implements Ifn. A Symbol called as a function expects one parameter, a collection, and it looks itself up in that collection. It’s meant to be used like this:

    user> ('a {'a :foo})
    :foo
    

    This is what it tries to do here. But you aren’t passing any parameters, so you get the error “Wrong number of args passed to: Symbol” (it expects a collection).

    For your code to work you’d need two levels of eval. This works, hopefully you can see why:

    user> (eval '((eval (quote user/a))))
    Hello, world
    user> ((eval (first l)))
    Hello, world
    

    Note that in real code, using eval directly is usually a really bad idea. Macros are a better idea by far. I’m only using it here for demonstration.

    Look in Compiler.java in the Clojure source to see how this all plays out. It’s not too hard to follow.

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

Sidebar

Ask A Question

Stats

  • Questions 149k
  • Answers 149k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Ok figured it out. I posted a question on Goolge's… May 12, 2026 at 9:34 am
  • Editorial Team
    Editorial Team added an answer To me, your ReportTrades message is mixing two different concepts.… May 12, 2026 at 9:34 am
  • Editorial Team
    Editorial Team added an answer Have you tried adding a category to UITableViewCell with your… May 12, 2026 at 9:34 am

Related Questions

I'd like to know how do the member types work in Scala, and how
I tried to ask this question previously howver I did not recieve the correct
I am currently moving my website from an existing web server to a new
I'm doing a short project just to experiment writing without the use of nib
I have a symbol in a .swf's library, with a linkage name of Pana.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.