Re: [racket-users] reading s-expressions from a file

2020-07-17 Thread gfb
Shouldn't the for be (for ([expr (in-producer read eof)] ⋯). One could also specify the input port there, as shown in reference for in-producer , possibly inside

Re: [racket-users] reading s-expressions from a file

2020-07-17 Thread George Neuner
On 7/17/2020 8:19 PM, Hendrik Boom wrote: Yes, I know the functino for reading s-expressions seems to be (read [in]). I want a loop that reads S-expressions and does something to each one, until there are no more to be found in a file. Now of course that's absurdly easy to do with a

Re: [racket-users] reading s-expressions from a file

2020-07-17 Thread Sorawee Porncharoenwase
(with-input-from-file "abc" (thunk (sequence->list (in-port Note that you need to “read” in the dynamic extent of with-input-from-file. Outside it, the port is closed. On Fri, Jul 17, 2020 at 5:19 PM Hendrik Boom wrote: > Yes, I know the functino for reading s-expressions seems to be

[racket-users] reading s-expressions from a file

2020-07-17 Thread Hendrik Boom
Yes, I know the functino for reading s-expressions seems to be (read [in]). I want a loop that reads S-expressions and does something to each one, until there are no more to be found in a file. Now of course that's absurdly easy to do with a tail-recursice loop. But I's like it to look like a