Skip to content

Run the functional-programming chapter's Racket examples (first half) - #140

Merged
dem-extra1 merged 4 commits into
mainfrom
claude/project-thread-2wtrwq-functional-programming
Nov 12, 2026
Merged

dem-extra1 merged 4 commits into
mainfrom
claude/project-thread-2wtrwq-functional-programming

Conversation

@dem-extra1

Copy link
Copy Markdown
Contributor

Requested by Ezra · project thread

Important

Stacked on #139, which adds the racket engine. Merge #139 first; this PR's base then moves to main.

Part of #131.

Why

The chapter typed what each Racket call returns, so nothing checked the values against the code.

What changes

In the first half of chapters/functional-programming.qmd, up to exr-twice:

  • the chapter includes _subfiles/_racket-setup.qmd, which registers the engine;
  • each fence that defines a function (h, ticket-price, absolute, twice, add-three) is a {racket} chunk with code-fold: false;
  • exm-absolute-value shows (absolute -7) and (absolute 2) as chunk output instead of typing 7 and 2;
  • the solutions to exr-evaluate-nested, exr-formula-from-code, exr-ticket-price and exr-twice keep their worked reasoning
    and end with "Racket returns the same values:" and a chunk that runs the same expressions.
    The exercises show only definitions, so no chunk output gives away an answer before its solution.

The syntax templates in def-racket-define and def-if-cond ((define (f x1 ... xn) body)) are not runnable,
and the evaluation traces in rem-evaluation and exm-substitution are hand rewriting steps, so they stay plain fences.
The prose inside definitions (def-booleans) still states a value inline; I left definitions alone.

The second half is #141, stacked on this one, because the two together exceed the 10-file cap.

Testing

Rendered the chapter to HTML and to revealjs locally with Racket 8.10. Every chunk's output matches the value the prose and solutions state:
(* (+ 1 2) (- 10 4)) 18, (- 20 (* 3 (+ 1 1))) 14, (+ 1 2 3 4) 10, (- (* (+ 2 3) 4) 1) 19,
(h 5) 15, (h (h 3)) 3, ticket-price 0, 8, 8, 12, absolute 7 and 2, twice 16, 48, 12.

The local PDF render fails on main too (\thm undefined in the theorem-counter snippet, with Debian's TeX Live rather than TinyTeX, which this container could not download), so the PDF check is the preview's.


Generated by Claude Code

…mples

The chapter typed what each Racket call returns, so nothing checked the
values against the code (#131). In the first half of the chapter, up to
exr-twice, each fence that defines a function is now a {racket} chunk,
and each typed value in an example is a chunk's output instead. The
solutions keep their worked reasoning and end with a chunk that runs the
same expressions, so a wrong hand calculation shows up beside the right
value.

The syntax templates in the definitions of define and cond are not
runnable, and the evaluation traces are hand rewriting steps, so they
stay plain fences.

Part of #131.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FWgYrEUFVHj2qKjKncHg77
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

dem-extra1 added a commit that referenced this pull request Nov 11, 2026
Pages now run Racket code at render time (mcs#131), and the reviewer
checks each chunk's output by running it. Without racket installed it
has to apt-get install it by hand in every review, which the #140
review called out. The reusable workflow's apt-packages input does
this once, before the review starts.


Claude-Session: https://claude.ai/code/session_01FWgYrEUFVHj2qKjKncHg77

Co-authored-by: Claude <noreply@anthropic.com>
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Base automatically changed from claude/project-thread-2wtrwq to main November 12, 2026 09:07
@dem-extra1

Copy link
Copy Markdown
Contributor Author

🤖 Antigravity agent report

Cross-harness review (Gemini 3.8 Flash (Medium) via Antigravity agy 1.4.12, standing in because Argon's quota is exhausted (resets in about 50 hours), read-only plan mode) at 8e2d7d2

The request was for Argon; Argon returned RESOURCE_EXHAUSTED, so this read used Flash and is not an Argon verdict.
I gave the model the full diff (its own diff, stacked on mcs#139) and the PR body.
I read the PR's own diff against its base PR; nothing was rendered. I checked the model's build-failure claim against the files at this head.

Findings

  1. $-7$ and 2 are typeset differently in one phrase (a nit).
    _absolute-value_exm.qmd: "Applied to $-7$ and to 2"; $2$ would match.

The model also said add-three is never defined in a {racket} chunk, so _twice_sol.qmd would fail to render. I reject that: _twice_exr.qmd defines both twice and add-three in its {racket} chunk (lines 6 to 13).

Verdict

VERDICT: FINDINGS (one nit; I reject the model's build-failure finding)

Reviewed-Commit: 8e2d7d2

Posted by Claude Code (AI agent) --- not written by a human.

"Applied to $-7$ and to 2" set one number in math and the other in
text, in the same phrase. Raised by the cross-harness read of #140.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FWgYrEUFVHj2qKjKncHg77
Copilot AI balanced review requested due to automatic review settings November 12, 2026 09:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copy link
Copy Markdown
Contributor Author

Addressed the nit in the Flash read at 8e2d7d2 in 094f73f: "Applied to $-7$ and to $2$" now sets both numbers as math.
I agree with the rejection of the other finding, since _twice_exr.qmd defines add-three in its {racket} chunk.
chapters/functional-programming.qmd renders to HTML with no warnings, and the rendered line shows both numbers in math.

Posted by Claude Code (AI agent) --- not written by a human.


Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

Claude finished review — View run


I reviewed the one new commit in this round, 094f73f. It changes 2 to $2$ in chapters/_subfiles/functional-programming/_absolute-value_exm.qmd:22. That file's other uses of the number 2 sit inside code, so no other edit was needed.

The change is prose-only and renders the same way as the surrounding $-7$. It adds no new macro question: the number 2 is a literal, not a variable with a semantic macro, and the display math in the example is unchanged. I found no new issues.

The prior round, "Ready for merge" (comment, 2026-11-11T10:32:36Z), still stands. The earlier full chunk-output verification, also "Ready for merge" (comment), isn't affected, because this commit doesn't touch any code chunk.

Verdict

Ready for merge

Structured Review Data (JSON)
{
  "schema_version": "1.1",
  "reviewer": "claude",
  "commit_sha": "094f73fd19193d9888fc3f1f48e779bc1614b7ef",
  "verdict": "CLEAN",
  "findings": [],
  "detailed_assessment": "The only new commit changes the bare number 2 to math-typeset 2 in the absolute-value example prose, which renders correctly and introduces no macro or markup problems.",
  "holistic_assessment": "The change is a one-line prose consistency fix within the PR's scope, leaves all racket chunks untouched, and does not affect the earlier verified outputs or the stacked dependency."
}

Reviewed commit: 094f73f

@github-actions

Copy link
Copy Markdown
Contributor

💰 Cost: $0.2092 (review) — run

@dem-extra1

Copy link
Copy Markdown
Contributor Author

🤖 Antigravity agent report

Cross-harness re-read (Gemini 3.8 Flash (Medium) via Antigravity agy 1.4.12, standing in because Argon's quota is exhausted (resets in about 50 hours), read-only plan mode) at 094f73f

This re-read covers the change from 8e2d7d2 to 094f73f (a one-line prose diff) against my earlier comment; Argon returned RESOURCE_EXHAUSTED, so this is not an Argon verdict.
Nothing was run.

Findings

None. "to $2$" is now in math mode like $-7$, which fixes my nit.

Verdict

VERDICT: CLEAN

Reviewed-Commit: 094f73f

Posted by Claude Code (AI agent) --- not written by a human.

@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.2
🚀 Preview available at: https://Morrison-Lab.github.io/mcs/pr-preview/pr-140/

Built to branch gh-pages at 2026-11-12 09:25 UTC.

@dem-extra1
dem-extra1 merged commit 68c7dd8 into main Nov 12, 2026
42 checks passed
@dem-extra1
dem-extra1 deleted the claude/project-thread-2wtrwq-functional-programming branch November 12, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants