`read-syntax` has two optional arguments: `(test read-syntax)` is effectively calling `(read-syntax (open-input-string "str"))`, which is equivalent to `(read-syntax (open-input-string "str") (current-input-port))`. -Philip
On Sun, Aug 26, 2018 at 8:43 PM Matthew Butterick <m...@mbtype.com> wrote: > With `read`, both `for/list` expressions evaluate the same way. > > With `read-syntax`, the first `for/list` works as expected, but the second > doesn't: it ignores the port argument and waits for something to happen on > standard input. > > ;;;;;;;;;;;;;;;;;;;;;;;;;;; > > #lang racket > (require rackunit) > > (define str "42 foo \"bar\"") > > (define (test proc) > (check-equal? > (parameterize ([current-input-port (open-input-string str)]) > (for/list ([stx (in-port proc)]) > stx)) > (for/list ([stx (in-port proc (open-input-string str))]) > stx))) > > (test read) > (test read-syntax) > > -- > 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. > -- 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.