Closed pmatos closed 6 years ago
I think we need to provide variant to allow others to define their custom arbitrary values. Following the example of the definition of arbitrary-natural, here's the definition of arbitrary/64 which generates arbitrary 64bit values:
variant
arbitrary
arbitrary-natural
arbitrary/64
(define arbitrary/64 (arbitrary (sized (lambda (n) (choose-integer 0 (- (expt 2 64) 1)))) (lambda (n gen) (variant n gen))))
However, this is not possible if variant is not provided.
Interestingly I just noticed that I can have a generator? passed to a property instead of an arbitrary?, therefore this is possible and it works:
generator?
arbitrary?
(define arbitrary/64 (choose-integer 0 (- (expt 2 64) 1)))
I think we need to provide
variant
to allow others to define their customarbitrary
values. Following the example of the definition ofarbitrary-natural
, here's the definition ofarbitrary/64
which generates arbitrary 64bit values:However, this is not possible if variant is not provided.