Re: [racket-users] Re: read-from-string(-all)

2019-02-07 Thread Laurent
aha, here it is! The closest form is then `(call-with-input-string str (λ(in)(port->list read in)))'. Thanks Sam and Alex! On Wed, Feb 6, 2019 at 10:01 PM Sam Tobin-Hochstadt wrote: > Also, almost that `read-all` function is provided as `port->list` from > `racket/port`. > > Sam > > On Wed, Feb

Re: [racket-users] Re: read-from-string(-all)

2019-02-06 Thread Sam Tobin-Hochstadt
Also, almost that `read-all` function is provided as `port->list` from `racket/port`. Sam On Wed, Feb 6, 2019 at 6:25 AM Alex Harsanyi wrote: > > (read-from-string "123") is equivalent to `(call-with-input-string "123" > read)` while read-from-string-all can be replaced by: > > (define (rea

Re: [racket-users] Re: read-from-string(-all)

2019-02-06 Thread Alex Harsanyi
On Wednesday, February 6, 2019 at 7:58:47 PM UTC+8, Laurent Orseau wrote: > > Oh nice, I didn't know we could do that one! > Point taken :) > > I suppose (hope?) you can still use sandboxing with memory limits for this? > You could make your own read table which disables all special treatment o

Re: [racket-users] Re: read-from-string(-all)

2019-02-06 Thread Laurent
Oh nice, I didn't know we could do that one! Point taken :) I suppose (hope?) you can still use sandboxing with memory limits for this? On Wed, Feb 6, 2019 at 11:52 AM Alex Harsanyi wrote: > > > On Wednesday, February 6, 2019 at 7:36:40 PM UTC+8, Laurent Orseau wrote: >> >> On Wed, Feb 6, 2019

Re: [racket-users] Re: read-from-string(-all)

2019-02-06 Thread Alex Harsanyi
On Wednesday, February 6, 2019 at 7:36:40 PM UTC+8, Laurent Orseau wrote: > > On Wed, Feb 6, 2019 at 11:25 AM Alex Harsanyi > wrote: > > although I am not sure it is a good idea to call read on strings received >> from the user... >> > > They're not eval'ed, > > Try: (call-with-input-string "

Re: [racket-users] Re: read-from-string(-all)

2019-02-06 Thread Laurent
On Wed, Feb 6, 2019 at 11:25 AM Alex Harsanyi 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 (eo