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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:39:36+00:00 2026-05-31T05:39:36+00:00

I am doing Intro to Functions problem, but I don’t quite understand what is

  • 0

I am doing Intro to Functions problem, but I don’t quite understand what is going on? How are the 4 expressions below different? If they are all the same, why have 4 different syntaxes?

(partial + 5)
#(+ % 5)
(fn [x] (+ x 5))
(fn add-five [x] (+ x 5))
  • 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-31T05:39:37+00:00Added an answer on May 31, 2026 at 5:39 am
    • (fn [x] (+ x 5)) and #(+ % 5) – These two are completely equivalent, the latter just uses the dispatch macro to make the code a little more concise. For short functions, the #() syntax is usually preferred and the (fn [x]) syntax is better for functions which are a bit longer. Also, if you have nested anonymous functions, you can’t use #() for both because of the ambiguity this would cause.

    • (fn add-five [x] (+ x 5)) – is the same as the above two, except it has a name: add-five. This can sometimes be useful, like if you need to make a recursive call to your function.*

    • (partial + 5) – In clojure, + is a variadic function. This means that it can accept any number of arguments. (+ 1 2) and (+ 1 2 3 4 5 6) are both perfectly valid forms. partial is creating a new function which is identical to +, except that the first argument is always 5. Because of this, ((partial + 5) 3 3 3) is valid. You could not use the other forms in this case.

    *When making a recursive call from the tail position, you should use recur, however this is not always possible.

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

Sidebar

Related Questions

So I'm having this problem, it should be pretty simple, but I don't know
Alright, so I've been doing some poking around, and I realize my problem, but
I've got a problem making alpha PNGs with PHP GD. I don't have imageMagik
I know this isn't going to be secure. But, I'd like to at least
I'm facing a problem in C++ for which I currently don't have an elegant
Big problem. I'm not sure what it was that I did, but it seems
I think this is going to be a vague question because I don't know
I seem to have a problem, I have a growing business to run but
i'm doing a function in gwt it sends an IQ stanza into a server
I'm doing research into a web API for my company, and it's starting to

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.