[plt-scheme] reading a whole file

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Tue Nov 4 17:13:44 EST 2008

All that is true, Richard, but it is equally true that some languages
have libraries that do a very nice job of the common case.  I can't
count the number of times I've fired up code like

  (let ([p (open-input-file ...)])
    (let loop ()
      (let ([l (read-line p)])
        (if (eof-object? l)
            empty
            (cons l (loop))))))

In my context, where I'm teaching content analysis, it's hard to
convince someone that this code (or any variant of it) is worth
writing in contrast to something like

  f = open(...)
  content = f.read()

Shriram


Posted on the users mailing list.