(with-input-from-file "file.txt"
  (lambda ()
    (for ((line (in-lines)))
      ....)))

On Tue, Jul 18, 2017 at 12:46 PM, Leith <leith...@gmail.com> wrote:

> Basic question, but I can't seem to find a good answer.  What is an
> example of "idiomatic" file I/O using racket?  Like, for example, open a
> file for reading and do something with every line in the file?
>
> The example here: https://docs.racket-lang.org/guide/io-patterns.html
> says "If you want to process individual lines of a file" but then it
> doesn't open a file at all.  It uses open-input-string.  I'm guessing it
> would be sufficient to use open-input-file instead?  Also, what is the
> right way to read a line at a time until EOF?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to