Add solution to Exercise 3.12 (append vs append_mutator)#1195
Merged
Conversation
Adds a SOLUTION giving the two missing responses for tail(x): ["b", null] after append (x is not modified), and ["b", ["c", ["d", null]]] after append_mutator (x's last pair is spliced to y). The explanation notes that z shares its last two pairs ["c", ["d", null]] with y, addressing the maintainer's correction on the issue. Also fixes a typo in z's printed value (['d, null] -> ['d', null]). Closes #860 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request fixes a syntax typo in a JavaScript output snippet and adds a detailed solution block explaining the difference between list copying in append and list mutation in append_mutator. The reviewer suggested improving the consistency of the solution block by replacing <P/> tags with blank lines and correcting a minor inaccuracy regarding structure sharing.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
<SOLUTION>to Exercise 3.12 (ex:append) inxml/chapter3/section3/subsection1.xml. The exercise asks for the two missingtail(x)responses and a box-and-pointer explanation, and had no solution.Responses
const z = append(x, y):tail(x)is["b", null]—appendcopies the pairs ofxand does not modify it.const w = append_mutator(x, y):tail(x)is["b", ["c", ["d", null]]]—append_mutatorsplicesyonto the last pair ofx, mutatingx.On the diagram correction
The explanation explicitly notes that the result
zshares its last two pairs["c", ["d", null]]withy(only the pairs holding"a"and"b"are freshly copied) — addressing your comment on the issue that the contributor's first diagram was wrong because it didn't show this sharing. I wrote the solution as prose (matching the JS-focused style of the adjacentex:mysterysolution) rather than embedding the contributed images, since no solution images exist in the repo and the first one was incorrect.Also
z:["a", ["b", ["c", ["d, null]]]]→["d", null](missing closing quote; thewvalue just below already had it right).Checks
<JAVASCRIPTINLINE>quote style matches the surrounding solutions (literal").Closes #860