Probably. 

FWIW, Kathy hasn’t maintained the system for a while and no longer gets mail 
about it. I am the one who implemented check-random. Is it the only thing that 
isn’t running under TR? 



> On Mar 28, 2017, at 12:38 PM, 'John Clements' via Racket Users 
> <racket-users@googlegroups.com> wrote:
> 
> Someone on stack overflow just discovered that “check-random”—from Kathy 
> Gray’s teaching language test framework—doesn’t work with TR. It looks like 
> this is because no one bothered to implement it. I suggested that they change 
> to rackunit, instead, and provided them with this quick hack version of 
> check-random. 
> 
> I guess my question is this: am I right in thinking that the only issue with 
> using Kathy’s teaching language test framework is that no one bothered to 
> provide a type for it? If so, is that something we should do?
> 
> Link to SO post: 
> 
> http://stackoverflow.com/questions/43072656/typed-racket-error-with-check-random
> 
> My suggestion to the OP:
> 
>    #lang typed/racket
> 
>    ; provides check-expect and others for testing
>    (require typed/rackunit)
> 
>    ;; create a new prng, set the seed to the given number, run the thunk.
>    (: run-with-seed (All (T) ((-> T) Positive-Integer -> T)))
>    (define (run-with-seed thunk seed)
>      (parameterize ([current-pseudo-random-generator
>                      (make-pseudo-random-generator)])
>        (random-seed seed)
>        (thunk)))
> 
>    ;; run a check-equal where both sides get the same PRNG seed
>    (define-syntax check-random-equal?
>      (syntax-rules ()
>        [(_ a b) (let ([seed (add1 (random (sub1 (expt 2 31))))])
>                   (check-equal? (run-with-seed (λ () a) seed)
>                                 (run-with-seed (λ () b) seed)))]))
> 
>    (: bar (-> Positive-Integer Integer))
>    (define (bar x)
>      (random x))
> 
>    (check-random-equal? (bar 6)
>                         (random 6))            
> 
> -- 
> 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.

Reply via email to