On Wed, Feb 6, 2019 at 11:25 AM Alex Harsanyi <alexharsa...@gmail.com>
wrote:

> (read-from-string "123") is equivalent to `(call-with-input-string "123"
> read)` while read-from-string-all can be replaced by:
>
>     (define (read-all in)
>       (let loop ([result '()])
>         (let ((v (read in)))
>           (if (eof-object? v)
>               (reverse result)
>               (loop (cons v result))))))
>
>     > (call-with-input-string "123 456" read-all)
>     '(123 456)
>

Thanks Alex. I just wanted to make sure I wasn't overlooking something
before writing my own version.  (and I'm particularly interested in the
-all variant.)


> although I am not sure it is a good idea to call read on strings received
> from the user...
>

They're not eval'ed, it's only data (for plotting, etc.). And the user is
me, using text copied from the output of some program (after some
grep/sed-ing).

-- 
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