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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:54:39+00:00 2026-06-14T17:54:39+00:00

I am currently attempting to resolve a question in a practice mid-term. The question

  • 0

I am currently attempting to resolve a question in a practice mid-term. The question asks for me to write an expression to append two lists (let us call them list1 and list2), and list2 must be appended to the end of list1. The function append cannot be used at any point in this. What I may use is cons, filter, accumulate, map, list-ref, and inumerate-interval. I have attempted various forms of getting to the solution, such as

(cons list1 list2)

(filter list? (map list (cons list1 list2)))

(list list1 list2)

(map list (list list1 list2)) 

I have spent 2 days attempting to find a solution to no avail. If anyone is able to guide me in the right direction, or even provide me with some form of assistance, I would be grateful.

Also, I apologize if there is some protocol that I am following incorrectly for the code formatting or the mannerisms in asking the question, as I am new to the site. Thank you.

  • 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-14T17:54:41+00:00Added an answer on June 14, 2026 at 5:54 pm

    Because this is homework, I can’t give you a straight answer. Instead, I’ll give you some hints, you can find the answer to your own question filing-in the blanks. This is the standard way to implement append:

    (define (my-append l1 l2)
      (cond (<???>                          ; if the first list is null
             <???>)                         ; then return the second list
            (<???>                          ; if the second list is null
             <???>)                         ; then return the first list
            (else                           ; otherwise `cons`
             (cons <???>                    ; the first element of the first list
                   (my-append <???> l2))))) ; process the rest of the first list
    

    The above solution uses cond, null?, cons, car and cdr. If you can’t use any of those and you’re restricted to the procedures in the question, try this instead (assuming accumulate is defined as a fold to the right):

    (define (my-append l1 l2)
      (accumulate
       <???>   ; what should be used for sticking list elements together?
       <???>   ; what should we return if the list being traversed is empty?
       <???>)) ; this is the list that we want to traverse 
    

    The above solution only uses accumulate and cons, as requested in the question. The idea is: traverse the first list recreating it element by element, until the list is exhausted – at that point, the next element will be the second list.

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

Sidebar

Related Questions

I am currently attempting to remove a number of .Resolve(s) in our code. I
I am currently attempting to implement a regular expression engine. (Yes, for fun. Go
I'm currently attempting to write my own program that mirrors the pmap command, specifically
I'm currently attempting to write an NES emulator through .NET and I have a
I am currently attempting to write a Script Writer along the lines of FinalDraft
I am currently attempting to merge two different text files in a perl script
I am currently attempting to implement a custom gridview interface to display data from
I'm currently attempting to migrate a legacy VBA/Microsoft Access application to Python and PyQt.
I am currently attempting to use Lucene to search data populated in an index.
I'm currently attempting to code one for part of a college project - binary/hex

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.