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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:07:06+00:00 2026-05-20T05:07:06+00:00

As an exercise I am trying to define let as a lambda function something

  • 0

As an exercise I am trying to define let as a lambda function something like this:

(define let_as_lambda 
  (lambda (var) 
     (lambda (value body) 
       (var body) val)))

And I am hoping to call it like this:

((let_as_lambda a) (3 (+ a 2)))

However there is no way to pass an unbound variable (in this case “a”) as an argument to a function. (I know it looks a little strange but I need let_as_lambda(var) to return a function.)

Can anyone show me how to do this? Any advice is appreciated.

In fact, just using this lambda-equivalent expression:

(let ((p1 v1) (p2 v2)...) body) = ((lambda (p1 p2...) body) v1 v2...)

I can’t even get this to work:

(define let_as_lambda 
    (lambda (var val body) 
      ((var body) val)))

Called by: (let_as_lambda a 3 (+ a 2))

Without getting the same complaint:

reference to an identifier before its definition: a

  • 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-20T05:07:06+00:00Added an answer on May 20, 2026 at 5:07 am

    let is a syntatic extension defined in terms of lambda. I don’t think you can define it as a function. Take a look at the example from The Scheme Programming Language

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

Sidebar

Related Questions

I'm trying to learn scheme via SICP. Exercise 1.3 reads as follow: Define a
As an exercise I'm trying to create a function that returns a generic list
I'm learning C++. I'm trying to do an exercise where I define several implementations
As an exercise I am trying to define a rule match-rewriter that behaves the
I'm trying to write a macro in Lisp that re-implements let using itself. This
I'm trying to solve the last exercise of this JavaScript Closure Tutorial which takes
I was trying a basic sorting exercise and I was hoping I could receive
I've been trying to do something as a learning exercise that I thought should
I'm trying to create a logger for a GWT application as an exercise to
I'm brand new to MVC and, as a learning exercise, I'm trying to re-write

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.