Re: [racket-users] Error location in test submodules

2019-04-03 Thread zeRusski
> #lang racket/base > (define f (λ _ (error 'FAIL))) > (module+ test > (require rackunit) > (define OK (string->unreadable-symbol "OK")) > (define-syntax-rule (check-OK-form expr) > (let ([val expr]) > (with-check-info (['input 'expr] ['expected OK] ['actual val]) >

Re: [racket-users] The distribution of numbers returned by (random)

2019-04-03 Thread Gustavo Massaccesi
The implementation is tricky, but you can understand the distribution looking at this "alternative" implementation: (define (myrandom) #;(/ (+ (random 4294967087) 1) (+ 4294967087 1)) (* (+ (random 4294967087) 1) 2.328306549295728e-10)) [it may have a tiny rounding difference] Gustavo

Re: [racket-users] Error location in test submodules

2019-04-03 Thread David Storrs
I'll also throw my hat in the ring with handy/test-more, which I'm in the process of breaking out into a separate module but have not yet found the tuits to finish. It takes a different approach than rackunit: Tests always have output regardless of whether they succeed or fail. Running a

Re: [racket-users] Error location in test submodules

2019-04-03 Thread Lukas Lazarek
If you want your tests to catch exceptions you need to wrap them in exception handlers, which you could write a macro to do for you; as Eric noted though you need to be careful to preserve source locations. These kinds of issues (error messages and managing source locations when using macros)

Re: [racket-users] Generate really large random numbers in Racket

2019-04-03 Thread Evelyn Mitchell
If you are implementing random number generators, you may want to use a test suite: Tu01 http://simul.iro.umontreal.ca/testu01/tu01.html or Dieharder https://webhome.phy.duke.edu/~rgb/General/rand_rate/rand_rate.abs Hope this helps, Evelyn Mitchell efmph...@gmail.com On Tue, Apr 2, 2019 at 12:55

Re: [racket-users] The distribution of numbers returned by (random)

2019-04-03 Thread Shaobo He
Thank you very much. This is exactly what I needed. Gustavo Massaccesi 于2019年4月3日周三 下午2:22写道: > The implementation is tricky, but you can understand the distribution > looking at this "alternative" implementation: > > (define (myrandom) > #;(/ (+ (random 4294967087) 1) (+ 4294967087 1)) >

Re: [racket-users] Generate really large random numbers in Racket

2019-04-03 Thread Shaobo He
Thank you. I think `random-natural` works for my case. 'Paulo Matos' via Racket Users 于2019年4月2日周二 上午12:49写道: > Check the math library by Neil Toronto: > > https://docs.racket-lang.org/math/base.html?q=random#%28part._.Random_.Number_.Generation%29 > > (random-natural k) → Natural > >