[racket] read text file
i'm trying to read a text file into a string, sort of like
readFile path -- in haskell
or
handle = open(path, 'r'); data = handle.read() # in python
however, in the guide
open-input-file
call-with-input-file
all use read-line
in lisp i could get the length of the stream and slurp the whole file
in:
(defun slurp (path)
"one way of reading in files"
(with-open-file (stream path)
(let ((seq (make-array (file-length stream)
:element-type 'character)))
(read-sequence seq stream)
seq)))
but what am i supposed to in racket?
(other than read-line right through to the end of the file, may be?)
or is reading it all in at one shot not considered the right way to do
it here?
--
In friendship,
prad
... with you on your journey
Towards Freedom
http://www.towardsfreedom.com (website)
Information, Inspiration, Imagination - truly a site for soaring I's