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

The Archive Base Latest Questions

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

Like this: > (my-append (list 1 2) 3) ‘(1 2 3) I know append

  • 0

Like this:

> (my-append (list 1 2) 3)
'(1 2 3)

I know append in racket is actually to concatenate two list.
And cons just add an element to the head of a list instead of tail

Does anyone have ideas about this?

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

    In Pyton, the append() method modifies the list in-place:

    lst = [1, 2]
    lst.append(3)
    
    lst
    => [1, 2, 3]
    

    Racket’s lists are immutable by default, the closest thing to an in-place append() requires you to use mutable lists, and you have to pack the element to be appended in a list of its own:

    (require scheme/mpair)
    
    (define lst (mlist 1 2))
    (mappend! lst (mlist 3))
    
    lst
    => (mlist 1 2 3)
    

    Notice that using immutable lists with the append procedure will produce a new list, leaving the original list untouched – so it wouldn’t be “like Python”:

    (define lst (list 1 2))
    (append lst (list 3))   ; this returns the new list '(1 2 3)
    
    lst
    => (list 1 2)
    

    In fact, Scheme’s append procedure behaves just like Python’s + operation between lists:

    lst = [1, 2]
    lst + [3]    # this returns the new list [1, 2, 3]
    
    lst
    => [1, 2]
    

    Come to think of it, Python’s append() might have a misleading name – in most functional programming languages, the append operation is always defined between two lists, whereas in Python it’s an operation between a list and an element. Maybe add() would have been a better name, like Java’s add() operation of the List interface.

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

Sidebar

Related Questions

I have a list to which I append Axes3D plots. Like this: self.myList.append(self.axes.plot(xValues, yValues,
I have a code like this $(document).ready(function(){ $(.add).bind ('click', function () { $('.main').append('<div class=add>Add
So I have code like this: $(.list).append('<li>hi</li>'); Here's a working example: http://jsfiddle.net/pXaSC When you
atm I have something like this: $('#fish').append(<div data-bind='foreach: rows'> + <div ... + <p>...</p>..);
After adding elements to page using something like this, $('#blah').append('<div id=bugsbunny></div>'); how can I
I'm creating script that will add , at every unordered list's list element with
I'm using python, and I have a list of sets, constructed like this: list
I am creating and appending images (divs) like this: $('#event_list_main').append('<img class=listed_event id=random_event src=final_tutorial_buttons/random.png height=50
I have a list like this <ul data-role=listview id=list data-filter=true></ul> it looks good on
I have a .txt file,primary list, with strings like this: f r y h

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.