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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:14:36+00:00 2026-05-21T03:14:36+00:00

What is the difference between two functions in Scheme, one defined like this— (define

  • 0

What is the difference between two functions in Scheme, one defined like this—

(define doSomething
    (lambda (x)
          (let (f (100))
               (f x))))

and the other like this?—

(define doSomething
          (let (f (100))
            (lambda (x) 
               (f x)))) 

In other words, what does it matter if the lambda is before the let or after it?

  • 1 1 Answer
  • 3 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-21T03:14:37+00:00Added an answer on May 21, 2026 at 3:14 am

    Your code won’t run. 🙂

    I will presume that you mean these instead:

    (lambda (x)
      (let ((f 100))
        (+ f x)))
    

    and

    (let ((f 100))
      (lambda (x)
        (+ f x)))
    

    In both cases, you’ll get back the passed-in argument plus 100.

    However, the main difference (ignoring technicalities about how let is just syntactic sugar over lambda) is that in the second version, f is a free variable. Say we do this:

    (let ((f 100))
      (list (lambda (x)
              (+ f x))
            (lambda (x)
              (set! f x))))
    

    This returns a list with two lambdas: the first of which is just like the ones previously, and the second one which allows you to change the value of f. Both lambdas access the same f, so running the setter will affect later calls to the first lambda.

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

Sidebar

Related Questions

What is the difference between this two F# type functions: let defaultInstance1<'a when 'a:(new:
What is the difference between these two functions? 1: $(document).ready(function myfunc() { function dosomething()
could be any difference in solving errors between this two functions?: To this question
I'm a newbie in Generic and my question is: what difference between two functions:
What is the difference between the two functions? Any performance difference? Thanks..
I have 2 classes that have exact two functions. The difference between them is
I want to get difference between two times. I calculate this by using following.
Difference between the two functions: (function($){ console.log($); }(test)); (function($){ console.log($); })(test); I've tried it
I don't see any difference between the two functions. Using the following JavaScript code:
What is the difference between the following two functions? ref class SomeClass; void swap(SomeClass^&

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.