17 lines
612 B
Text
17 lines
612 B
Text
(lc=
|
|
counts c
|
|
. fil$(!arg,r) {open file for reading}
|
|
& 0:?counts
|
|
& whl
|
|
' ( fil$:?c {read a byte}
|
|
& ( !c:(~<A:~>Z|~<a:~>z)
|
|
| 0
|
|
)
|
|
+ !counts
|
|
: ?counts {simply add any found letter to the sum}
|
|
)
|
|
& fil$(,SET,-1) {close the file by seeking to impossible file position.}
|
|
| !counts {return the sum}
|
|
);
|
|
|
|
lc$"valid.bra" {example: count letters in Bracmat's validation suite.}
|