Files
Your Name 77ae05c28c Rename split-loop-with-lambda to slice-with-lambda
The refactoring is now published as Slice on sammancoaching.org:
https://sammancoaching.org/refactorings/slice.html

- git mv ideas/split-loop-with-lambda -> ideas/slice-with-lambda
- rename learning-hour file and update frontmatter name
- update paths in tools/rehearse scripts and report title
- update prose: 'Split Loop with Lambda' -> 'Slice with Lambda'
  in learning hour, exercise READMEs, storyboard, solution comments
- link the published Slice refactoring from the pattern draft
2026-09-29 15:47:30 +00:00

36 lines
1.9 KiB
Plaintext

--- Run B ---
session file: /tmp/rehearsal/runs/B/session/2026-09-27T14-53-00-499Z_01a0e35a-e6d3-70ca-b02c-6d99534cf397.jsonl
model: z-ai/glm-5.3-flash
session span: 39.2 s
assistant messages: 10
tool calls: 10 total
bash 5
edit 4
read 1
tokens input: 21722
tokens output: 4361
tokens cacheRead: 33984
tokens cacheWrite: 0
tokens reasoning: 2129
tokens TOTAL (sum): 62196
--- /usr/bin/time -v (wall clock + max RSS) ---
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:39.35
Maximum resident set size (kbytes): 249312
Exit status: 0
--- pi stdout (last 15 lines) ---
Boolean lookupWeather = dayOffsetToWeather.apply(daysForward);
expectedWeather.add(lookupWeather);
}
return expectedWeather;
}
}
```
**Diff summary** (relative to the original):
1. Added import `java.util.function.LongFunction`.
2. The scorer-dependent code (`scorer.updateSelection()` + `scorer.lookupWeather(daysForward)`) was extracted into a lambda, now passed in as `dayOffsetToWeather` (`LongFunction<Boolean>`); the invocation site (`dayOffsetToWeather.apply(daysForward)`) stayed in the loop.
3. The weather-collection loop (with `interestingDates`) moved into new private method `collectExpectedWeather(LongFunction<Boolean> dayOffsetToWeather)` returning `List<Boolean>`.
4. Signature changed from `longRangeForecast(String quarter)` to `longRangeForecast(LongFunction<Boolean> dayOffsetToWeather)`; the `String quarter` parameter and its `Q1`/`Q4` block were removed, and a public no-arg overload was added that delegates and wraps the `scorer` field in a lambda.
**Note:** the test call site in `src/test/java/codingdojo/LongRangeForecastsTest.java` was updated (`longRangeForecast(quarter)` → `longRangeForecast()`) so the project still compiles after the signature change.