Try file->string Jay
On Mon, Dec 6, 2010 at 7:43 PM, prad <p...@towardsfreedom.com> wrote: > 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 > _________________________________________________ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users > -- Jay McCarthy <j...@cs.byu.edu> Assistant Professor / Brigham Young University http://faculty.cs.byu.edu/~jay "The glory of God is Intelligence" - D&C 93
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users