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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:21:28+00:00 2026-05-13T07:21:28+00:00

What is the difference between (function (lambda …)) and (lambda …) and ‘(lambda …)

  • 0

What is the difference between

(function (lambda ...))

and

(lambda ...) 

and

'(lambda ...)

?

It seems three are interchangeable in a lot of cases.

  • 1 1 Answer
  • 1 View
  • 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-13T07:21:29+00:00Added an answer on May 13, 2026 at 7:21 am

    They are pretty interchangeable. The answer is that function enables the lambda to be byte compiled, whereas the other two do not (and are equivalent). Note: this does not mean that function actually byte compile the lambda.

    How might one figure that out? A little Emacs lisp introspection provides some clues. To start: C-h f function RET:

    function is a special form in ‘C
    source code’.

    (function arg)

    Like ‘quote’, but preferred for
    objects which are functions. In byte
    compilation, ‘function’ causes its
    argument to be compiled. ‘quote’
    cannot do that.

    Ok, so that’s the difference between (function (lambda ...)) and '(lambda ...), the first tells the byte compiler that it may safely compile the expression. Whereas the 'ed expressions may not necessarily be compiled (for they might just be a list of numbers.

    What about just the bare (lambda ...)? C-h f lambda RET shows:

    lambda is a Lisp macro in `subr.el’.

    (lambda args [docstring] [interactive]
    body)

    Return a lambda expression. A call of
    the form (lambda args docstring
    interactive body) is self-quoting; the
    result of evaluating the lambda
    expression is the expression itself.
    The lambda expression may then be
    treated as a function, i.e., stored as
    the function value of a symbol, passed
    to ‘funcall’ or ‘mapcar’, etc.

    Therefore, (lambda ...) and '(lambda ...) are equivalent.

    Also, there is the notation #'(lambda ...), which is syntactic sugar for (function (lambda ...)).

    For more information on functions in Emacs lisp, read the Functions info pages.

    Just to check all this, you can type the following into the *scratch* buffer and evaluate the expressions:

    (caddr '(lambda (x) (+ x x)))
    (+ x x)
    
    (caddr (lambda (x) (+ x x)))
    (+ x x)
    
    (caddr (function (lambda (x) (+ x x))))
    (+ x x)
    
    (equal '(lambda (x) (+ x x))
           (function (lambda (x) (+ x x))))
    t
    
    (equal '(lambda (x) (+ x x))
           (lambda (x) (+ x x)))
    t
    

    So, all three variants of using lambda just build up lists that may be used as functions (one of which may be byte compiled).

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

Sidebar

Related Questions

Possible Duplicate: Difference between (function(){})(); and function(){}(); I have seen it a lot by
Possible Duplicate: Difference between (function(){})(); and function(){}(); I am trying to understand a few
I was wondering if there are any difference between function __construct() { parent::__construct(); $this->load->
What is the difference between Training function and learning function in Artificial Neural Network
Is there any difference between a variable declared as static outside any function between
Possible Duplicate: What is the difference between a function expression vs declaration in Javascript?
What is the difference between $(element).each(function(){ }); And $.each(element,function(){ });
What is difference between the following two function definitions? A 2D array is being
What is the difference between a pure virtual function and a virtual function? I
What is the difference between + and - before the function name interface declaration

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.