This program works in 7.3, but not 7.4, which complains about the use
of strings before it's definition.  Swapping the order of valid-progs
and strings fixes that, but the program then loops, although I don't
understand why.

On Thu, Sep 5, 2019 at 11:10 AM David Van Horn <dvanh...@cs.umd.edu> wrote:
>
> How about this: a stream of strings which can be be parsed and
> compiled.  (Note that this will loop when it gets to the first program
> that makes the compiler loop; luckily it's inefficient enough that
> you'll never actually get there.)
>
> #lang racket
> (define valid-progs
>   (for/stream ([p strings]
>                #:when (valid p))
>     p))
>
> (define strings
>   (stream-cons ""
>                (for*/stream ([s strings]
>                              [i (in-range 0 #x10FFFF)]
>                              #:when (not (<= #xD800 i #xDFFF)))
>                  (string-append (string (integer->char i)) s))))
>
> (define (valid x)
>   (with-handlers ([exn:fail? (λ _ #f)])
>     (compile (with-input-from-string x
>                (λ () (begin0 (read)
>                              (unless (eof-object? (read))
>                                (error "fail"))))))
>     x))
>
> On Thu, Sep 5, 2019 at 10:58 AM Adam Golding <adamgold...@gmail.com> wrote:
> >
> > It's okay if the program never halts.
> >
> > --
> > 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.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/racket-users/70d0b081-eef8-44a6-b2e3-5a72eba7ff5a%40googlegroups.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFJHQkGnh-hUB4Rbg9jQNrOtjSXFyP2_w4ci1w0WcKuMe58MyQ%40mail.gmail.com.

Reply via email to