From: back0003@gold.tc.umn.EDU (back0003)
Newsgroups: alt.lang.scheme.scsh
Any clues are welcome.
(define (witless-grep)
(let ((temp-line (read-line my-file)))
(if (= temp-line end-of-file) ;; How to test for EOF?
#t
(if (string-match my-regular-expression temp-line)
(begin
(write-string temp-line)
(newline)
(witless-grep))
(witless-grep)))))
From: bdc@martigny.ai.mit.EDU (Brian D. Carlstrom)
Message-ID: <199601151932.OAA26771@bloom-beacon.MIT.EDU>
References: <Pine.LNX.3.91.960115140352.322A-100000@sacc.agoff.umn.edu>
NNTP-Posting-Host: bloom-beacon.mit.edu
I couldn't find this in the manual myself. I had to look in scsh.scm.
Use EOF-OBJECT?. You guys! This is R4RS.
Jan's procedure would be written with the R4RS EOF-OBJECT? as
(define (witless-grep)
(let ((line (read-line my-file)))
(cond ((not (eof-object? line))
(cond ((string-match my-regular-expression line)
(write-string line)
(newline)))
(witless-grep)))))
-Olin
|