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 9265513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:05:11+00:00 2026-06-18T14:05:11+00:00

Occasionally when looking at other people’s Clojure code, I see a function defined via

  • 0

Occasionally when looking at other people’s Clojure code, I see a function defined via defn and then called using the var-quote syntax, e.g.:

user> (defn a [] 1)
#'user/a
user> (a)   ; This is how you normally call a function
1
user> (#'a) ; This uses the var-quote syntax and produces the same result
1

For the life of me I can’t figure out the difference between these two ways of calling a function. I can’t find anything in the evaluation documentation to say what happens when the operator of a call is a var that might suggest why the second form would be preferred. They both seem to respond in the same to binding assignments and syntax-quoting.

So, can somebody please provide a code sample that will illustrate the difference between (a) and (#'a) above?

Edit: I know that var-quote can be used to get to a var that’s shadowed by a let lexical binding, but that doesn’t seem to be the case in the code that I’m looking at.

  • 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-06-18T14:05:12+00:00Added an answer on June 18, 2026 at 2:05 pm

    (#'a) always refers to the var a, while (a) can be shadowed by local bindings:

    user> (defn a [] 1)
    #'user/a
    user> (let [a (fn [] "booh")] [(a) (#'a)])
    ["booh" 1]
    

    But most actual uses of var-quote / function call are not calling the var-quote expression directly, but instead cache its value so that higher-order constructs refer to the current value of var a instead of its value when passed in:

    (defn a [] 1)
    (defn my-call [f] (fn [] (+ 1 (f))))
    (def one (my-call a))
    (def two (my-call #'a))
    (defn a [] 2)
    
    user> (one)
    2
    user> (two)
    3
    

    This is mostly useful for interactive development, where you’re changing some function that gets wrapped in a bunch of other functions in other packages.

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

Sidebar

Related Questions

Occasionally I am looking at some code, I search for usages of a method
I occasionally see portraits and other images which have been redrawn into an abstract
I am getting deadlocks occasionally in sql server. I created a function for locking
Occasionally when performing a rebase using the MercurialEclipse plugin my repository gets thrown into
Occasionally I will know that there is a .NET Framework function that returns a
Occasionally I run into this limitation using SQL Server 2000 that a row size
I'm using a 3rd party tool, which uses a 4th party plugin. Occasionally, the
I find myself occasionally in C# 3.0 looking for ways to simulate the notion
Ever since switching to Mac based RoR development, I occasionally see that Webrick dies
Occasionally a TextView with dynamic content will show a price. For example, as part

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.