Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution to Exercise 3.12 #860

Open
jonathantorres opened this issue Jan 8, 2023 · 1 comment
Open

Solution to Exercise 3.12 #860

jonathantorres opened this issue Jan 8, 2023 · 1 comment
Labels
Exercise solution Solutions to textbook exercises _work in progress

Comments

@jonathantorres
Copy link
Contributor

pointers

  • After the call to const z = append(x, y), tail(x) = ["b", null]. Since append creates a new copy of x with the elements of y.

pointers

  • After the call to const w = append_mutator(x, y), tail(x) = ["b", ["c", ["d", null]]]. Since append_mutator sets the tail of the last pair of x to y.
@martin-henz
Copy link
Member

The first picture is not correct, because the list

["c", ["d", null]]

is shared between y and z.

@martin-henz martin-henz added _work in progress Exercise solution Solutions to textbook exercises labels Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Exercise solution Solutions to textbook exercises _work in progress
Projects
None yet
Development

No branches or pull requests

2 participants