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

  • Home
  • SEARCH
  • 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 6673367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:37:10+00:00 2026-05-26T03:37:10+00:00

I was given this bit of Scheme code, and have been tasked with translating

  • 0

I was given this bit of Scheme code, and have been tasked with translating the code into Perl.

(define (makecounter)
 (let ((x 0)) (lambda () (begin (set! x (+ x 1)) x))))

I know this is supposed to be a closure function, but I’m can’t quite get what this is supposed to be doing. Any ideas?

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

    Hint:

    (define c1 (makecounter))
    (define c2 (makecounter))
    (c1)
    => 1
    (c1)
    => 2
    (c1)
    => 3
    (c2)
    => 1
    (c2)
    => 2
    (c1)
    => 4
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been given this hypothetical problem: Osama returns from the dead and wants
I was given this little bit of code by my teacher for this weeks
i Have been given this simple task , I want to connect to facebook
I know this is a bit bleeding edge, but here's the question anyway: Given
So I have been given a C program, which I am trying to make
This week I've been working on some reflection-based code, and during unit testing found
I have this piece of code: NSString *body = dataItem.body; NSData* data=[body dataUsingEncoding:NSUTF8StringEncoding]; if
It is looking like i have a major memory leak in this little bit
Since the iOS 5 Betas I have been testing my app's code and the
Sorry if this is a bit random, but is it good practice to give

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.