Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Adds lib/tcl/conformance.sh: runs .tcl programs through the epoch protocol, compares against # expected: annotations, writes scoreboard.json and scoreboard.md. All 3 classic programs pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15 lines
295 B
Tcl
15 lines
295 B
Tcl
# expected: 13
|
|
proc for-each-line {var lines body} {
|
|
foreach item $lines {
|
|
uplevel 1 [list set $var $item]
|
|
uplevel 1 $body
|
|
}
|
|
}
|
|
|
|
# Usage: accumulate lengths of each "line"
|
|
set total 0
|
|
for-each-line line {hello world foo} {
|
|
incr total [string length $line]
|
|
}
|
|
set total
|