Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions accretive-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ Run it with `FACTOR=/path/to/factor bin/check-accretive [slug...]`.

## Results

The initial audit found 11 of 47 not Accretive. The 5 Mode-B and 5 Mode-A
exercises have since been fixed; only the 1 structural case remains open.
The initial audit found 11 of 47 not Accretive. All 11 have since been fixed —
**every concept exercise is now accretive (47/47)**. The table records what the
audit flagged and how each was resolved.

| Verdict | Count | Exercises |
| Original verdict | Count | Exercises |
|---|---|---|
| Accretive | 46 | all others |
| Mode A (fixed) | 5 | bering-bearings, boatswains-bilge, dragons-descendants, factory-failsafe, pirates-path |
| Mode B (fixed) | 5 | garden-gathering, lighthouse-logbook, poetry-club, quayside-crew, tellers-triage |
| Structural (open) | 1 | telegraphers-tape |
| Structural (fixed) | 1 | telegraphers-tape |

## Mode A — a definition was introduced after task 1 (fixed)

Expand Down Expand Up @@ -106,14 +106,16 @@ that owns the word, or (for opaque structures) observing through a library word.
- **quayside-crew** — a task-3 test `[ <crane> 5 over hoist-crate tonnage>> ... ]`
used `hoist-crate` (task 4) to show cranes are independent; moved to task 4.

## Structural
## Structural — tests not grouped by task (fixed)

- **telegraphers-tape** — the tests use descriptive `print` labels, not `TASK:`
markers, and each test is end-to-end (construct + read + dispose together), so
no prefix of tasks passes on its own.
*Fix (larger):* regroup the tests under per-task `TASK:` markers, ordered so
each task's tests need only words from that task and earlier; or accept it as a
documented exemption.
- **telegraphers-tape** — the tests used descriptive `print` labels, not `TASK:`
markers, and each was end-to-end (construct + read + dispose together), so no
prefix of tasks passed on its own. *Fixed* by regrouping the tests under
per-task `TASK:` markers (task order unchanged) and adding checkpoints for the
early tasks: task 1 reads through `wire>>` to prove the constructor stored the
wire; task 2 checks `input-stream?`. Each group now calls only words from its
own task and earlier. (Like the Mode-A fixes, the task-1 test touches the
tuple, so the exercise is accretive-via-task1.)

## Suggested track-wide rules (to keep new exercises Accretive)

Expand Down
7 changes: 4 additions & 3 deletions bin/check-accretive
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ MAPS = {
"rpn-calculator": {"add-op":1,"multiply-op":2,"apply-op":3,"evaluate":4,"evaluate-named":5,"divide-op":6},
"secrets": {"shift-back":1,"set-bits":2,"flip-bits":3,"clear-bits":4},
"signalers-satchel": {"quote-value":1,"flag-body":2,"split-flag":3,"triangulate":4,"triangle-stats":5},
"telegraphers-tape": {"<tape>":1,"stream-read1":3,"stream-element-type":4,"dispose*":5},
"tellers-triage": {"new-queue":1,"join-queue":2,"next-name":3,"serve-all":4},
"valentines-day": {"rate-restaurant":1,"rate-movie":2,"rate-walk":3,"rate-activity":4,"approval-counts":5},
"vltava-weather-watch": {"read-readings":1,"latest-reading":2,"log-text":3,"record-reading":4,"rewrite-log":5},
Expand All @@ -84,14 +85,14 @@ MAPS = {
# Exercises whose Mode-B prefix run we cannot synthesize automatically (MACRO:
# bodies cannot be re-stubbed with a throw, and exercises without TASK: markers
# have no prefixes). Mode A is still checked for them.
MODEB_SKIP = {"signal-stencils", "telegraphers-tape", "bering-bearings",
"boatswains-bilge"}
MODEB_SKIP = {"signal-stencils", "bering-bearings", "boatswains-bilge"}

# The shipped stub does not make the test file compile, but the missing
# definition is created in task 1, so the exercise is still accretive by the
# implement-first-K-tasks rule (a student who does task 1 sees task 1 pass).
ACCRETIVE_VIA_TASK1 = {"lasagna", "role-playing-game", "factory-failsafe",
"dragons-descendants", "bering-bearings"}
"dragons-descendants", "bering-bearings",
"telegraphers-tape"}

DEF_STARTERS = {":","::","M:","M::","TYPED:","TYPED::","MEMO:","MEMO::"}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,40 @@ USING: accessors destructors exercism-tools io
io.streams.string kernel telegraphers-tape tools.test ;
IN: telegraphers-tape.tests

"Telegraphers Tape:" print

"Reading a Morse symbol from a clean wire" print
{ CHAR: . }
[ "." <string-reader> <tape> stream-read1 ]
unit-test
TASK: 1 <tape>
! the constructor stores the wire — read straight from it
{ CHAR: a } [ "abc" <string-reader> <tape> wire>> stream-read1 ] unit-test

STOP-HERE

"Skipping noise before a dash" print
{ CHAR: - }
[ "xy-" <string-reader> <tape> stream-read1 ]
unit-test

"Returning f at end of wire" print
{ f }
[ "" <string-reader> <tape> stream-read1 ]
unit-test

"Returning f when only noise remains" print
{ f }
[ "xyz" <string-reader> <tape> stream-read1 ]
unit-test

"Reading dot, dash, space in sequence" print
{ CHAR: . CHAR: - CHAR: \s }
[ "x.y-ab cz" <string-reader> <tape>
[ stream-read1 ] [ stream-read1 ] [ stream-read1 ] tri ]
unit-test

"stream-element-type delegates to the wire" print
{ +character+ }
[ "" <string-reader> <tape> stream-element-type ]
unit-test

"dispose marks the tape as disposed" print
{ t }
[ [ "ab" <string-reader> <tape>
dup dispose disposed>> ] with-destructors ]
unit-test

"with-input-stream disposes automatically" print
{ t }
[ "" <string-reader> <tape>
dup [ ] with-input-stream
disposed>> ]
unit-test
TASK: 2 input-stream instance
{ t } [ "x" <string-reader> <tape> input-stream? ] unit-test

TASK: 3 stream-read1
! reading a Morse symbol from a clean wire
{ CHAR: . } [ "." <string-reader> <tape> stream-read1 ] unit-test
! skipping noise before a dash
{ CHAR: - } [ "xy-" <string-reader> <tape> stream-read1 ] unit-test
! end of wire returns f
{ f } [ "" <string-reader> <tape> stream-read1 ] unit-test
! only noise remains returns f
{ f } [ "xyz" <string-reader> <tape> stream-read1 ] unit-test
! dot, dash, space in sequence
{ CHAR: . CHAR: - CHAR: \s } [
"x.y-ab cz" <string-reader> <tape>
[ stream-read1 ] [ stream-read1 ] [ stream-read1 ] tri
] unit-test

TASK: 4 stream-element-type
! the element type delegates to the wire
{ +character+ } [ "" <string-reader> <tape> stream-element-type ] unit-test

TASK: 5 dispose
! dispose marks the tape as disposed
{ t } [
[ "ab" <string-reader> <tape> dup dispose disposed>> ] with-destructors
] unit-test
! with-input-stream disposes automatically
{ t } [
"" <string-reader> <tape> dup [ ] with-input-stream disposed>>
] unit-test
Loading