| While looking at various examples of the use of w/infile, I noticed there is a bug in the codelines function in the file code.arc. The function is defined as: (def codelines (file)
(w/infile in file
(summing test
(whilet line (readline in)
(test (aand (pos nonwhite line) (isnt it #\;)))))))
The problem is that the captured variable "it" in aand has the position of the first nonwhite character, which is compared to #\;. What should actually be compared to #\; is the first nonwhite character (rather than its position). This bug causes the function to erroneously count commented out lines. Changing "it" to "line.it" corrects the bug. (def codelines (file)
(w/infile in file
(summing test
(whilet line (readline in)
(test (aand (pos nonwhite line) (isnt line.it #\;)))))))
|