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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:48:53+00:00 2026-06-15T16:48:53+00:00

Using the built-in map and zip functions, define a Scheme function zipadd that takes

  • 0

Using the built-in map and zip functions, define a Scheme function zipadd that takes two lists of numbers and returns the a list consisting of the corresponding elements added together. You may assume that the lists are the same length. For example (zipadd ‘(1 2 3) ‘(4 5 6)) is (5 7 9). (A correct solution not using zip and map will be worth 8 points.)

I am not sure how to do this. I would really like to know the solution before my exam tomorrow. Can anyone help me please?

  • 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-06-15T16:48:54+00:00Added an answer on June 15, 2026 at 4:48 pm

    For starters, Racket doesn’t come with a zip procedure, although it’s trivial to implement one:

    (define (zip lst1 lst2)
      (map list lst1 lst2))
    

    Now regarding your question – a solution using only map is the simplest way to solve this problem and it’s very similar to the above procedure, just think what could be used to fill the blank:

    (define (zipadd lst1 lst2)
      (map <???> lst1 lst2))
    

    Although it’s a bit more contrived, you can use zip to reach the same solution (and get full marks). Try to figure out how it works – zip sticks together all pairs of elements in both lists, creating a list of two-element lists. Afterwards, map will traverse that list and apply a procedure to each element (remember: each element is a list of two elements), creating a new list with the results:

    (define (zipadd lst1 lst2)
      (map (lambda (x) <???>) ; x is a list with two numbers, how to add them?
           (zip lst1 lst2)))
    

    Finally and for completeness’ sake, a solution without using map or zip. It’s an implementation of map for the special case where the numbers on both lists must be added pair-wise:

    (define (zipadd lst1 lst2)
      (if <???>                         ; if either list is empty (*)
          <???>                         ; then return the empty list
          (cons (+ <???> <???>)         ; else add the first elements of both lists
                (zipadd <???> <???>)))) ; and advance the recursion over both lists
    

    (*) Remember: both lists are assumed to have the same length.

    Try to write all the variations of the solution, it’ll be interesting to compare different approaches to solve the same problem. And if you have to use map and zip to get full marks then by all means use the second version above, just be aware that’s not the simplest nor the most efficient way to express the solution to the problem at hand.

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

Sidebar

Related Questions

I am trying to build an elegant transpose function using functions mapn and zip
I've built a map using the GMaps API with custom markers. On my PC
I've built a pie chart that is an image with client side image map.
I'm trying to interact with a google map using python. I've built an application
When you're using WTL, you can freely copy controls that represent built-in objects: //
Hello I'm using built in Google Map to show route to user. When I
I've built several Javascript applications for map charts using google maps, and I was
I have an application, built using MVC, that produces a view which delivers summary
I am using kineticJS to build a map for a computer game that I
I'm using the Google Maps API to build a map full of markers, but

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.