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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:30:44+00:00 2026-05-31T21:30:44+00:00

In clojure, I’d like to know what are the differences between the three below.

  • 0

In clojure, I’d like to know what are the differences between the three below.

(println (map + '(1 2 3) '(4 5 6))) 

(println (map '+ '(1 2 3) '(4 5 6))) 

(println (map #'+ '(1 2 3) '(4 5 6))) 

The results are

(5 7 9) 

(4 5 6) 

(5 7 9) 

I can’t understand the second one’s behavior.

I feel the first one and the third one are the same in clojure which is Lisp-1
and doesn’t distinguish between evaluating a variable and the identically named function.

This may be a basic question, but there seems not to be enough infomation. Please teach me.

Thanks.

  • 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-31T21:30:45+00:00Added an answer on May 31, 2026 at 9:30 pm

    Regarding the third case, in contrast to Common Lisp, #'+ does not read as (function +) and refer to the value of the symbol + in the function namespace, since Clojure does not have a function namespace. Instead, it reads as (var +) and refers to the var called +. Applying a var is the same as applying the value stored in the var.

    In the second case, you are repeatedly applying a symbol to a pair of numbers. This is valid by accident. Applying a symbol to a map is the same as indexing into that map:

    user> ('a {'a 1, 'b 2, 'c 3, '+ 4})
    1
    user> ('+ {'a 1, 'b 2, 'c 3, '+ 4})
    4
    

    If you supply a second argument, it is used as the default value in case no matching key is found in the map:

    user> ('+ {'a 1, 'b 2, 'c 3} 4)
    4
    

    Since in each iteration, you apply the symbol + to a pair of numbers, and since a number isn’t a map and therefore doesn’t contain + as a key, the second argument is returned as the default value of a failed match.

    user> ('+ 'foo 4)
    4
    user> ('+ {} 4)
    4
    user> ('+ 1 4)
    4
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In clojure, I can destructure a map like this: (let [{:keys [key1 key2]} {:key1
Can Clojure implement (g ∘ f) constructions like Haskell's g . f ? I'm
In clojure, it is possible to destructure some keys of a map like this:
In Clojure, I would like to combine several maps into a single map where
In clojure, i can use doc as below: Clojure> (doc juxt) ------------------------- clojure.core/juxt ([f]
Clojure structs can be arbitrarily extended, adding new fields. Is it possible to extend
in clojure i have vector [myfn1 myfn2 myfn3] how can i call functions named
In clojure, I would like to write a tail-recursive function that memoizes its intermediate
Does clojure have a powerful 'loop' like common lisp. for example: get two elements
In clojure you can create a SwingWorker proxy and implement doInBackground and do methods.

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.