converting a file to list or string in scheme

racket, scheme

Solution

Take a look at the `file->list` function or `file->lines`, which should do what you want in Racket. That is, something like `(file->lines "blah.txt")` will give you a list of lines from the file. More generally, look at the guide entry on I/O.

Problem

I'm having a bit of an issue taking a text file and converting it into a list or string. Say I have "blah.txt" which holds: ``` 3 + 4 ``` Now I want to call that file which I know can be done by ``` (define in (open-input-file "blah.txt")) ``` Where do I take it from here?

Original source