Repository navigation
docs: Add an environment diagram style guide - #75
Merged
Merged
Conversation
Add a guide for textbook authors drawing environment diagrams in PlantUML, with worked examples for V3, V4, V5, SET, REF, NAME, and NEED. Point to it from the general style guide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The style-guide rule needs a ThunkRef exception to distinguish NAME’s per-access evaluation from NEED’s memoization and avoid incorrectly depicting separate results as one shared value.
1 open issue
What changed in this PR
Adds guidance for textbook authors to create consistent PlantUML environment diagrams, with worked examples covering scope, references, and parameter passing.
Changes:
- Defines conventions for diagram structure, naming, arrows, evaluation markers, and layout adjustments.
- Adds examples for V3, V4, V5, SET, REF, NAME, and NEED.
- Points authors to the new documentation from the general style guide.
| File | Description |
|---|---|
style-guide.md |
Adds a pointer to the environment diagram guide. |
docs/environment-diagrams/style-guide.md |
Defines diagram conventions and PlantUML guidance. |
docs/environment-diagrams/diagrams-v5.md |
Illustrates recursive bindings and closure calls. |
docs/environment-diagrams/diagrams-v4.md |
Illustrates lexical scope and captured environments. |
docs/environment-diagrams/diagrams-v3.md |
Shows nested bindings and variable shadowing. |
docs/environment-diagrams/diagrams-set.md |
Shows mutation, parameter references, and persistent captured state. |
docs/environment-diagrams/diagrams-ref.md |
Contrasts variable and expression arguments under call-by-reference. |
docs/environment-diagrams/diagrams-need.md |
Shows thunk memoization and read-only argument references. |
docs/environment-diagrams/diagrams-name.md |
Shows argument references and deferred evaluation under call-by-name. |
Review effort: Balanced
| | `proc` | A new `ProcVal`, or *closure*, whose `env` points to the environment where the `proc` was evaluated | | ||
| | A function call | A new environment extending the closure's `env`, not the caller's | | ||
| | Primitive such as `+` or `add1` | A new `IntVal` | | ||
| | A variable used as a value | The same value object the variable is bound to, not a copy | |
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.

Add a guide for textbook authors drawing environment diagrams in PlantUML, with worked examples for V3, V4, V5, SET, REF, NAME, and NEED. Point to it from the general style guide.