caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] [ANN] random-generator 0.1 (Was: [ANN] QCheck 0.1)
@ 2013-10-25 14:51 Gabriel Scherer
  2013-10-25 15:47 ` Gabriel Kerneis
  0 siblings, 1 reply; 4+ messages in thread
From: Gabriel Scherer @ 2013-10-25 14:51 UTC (permalink / raw)
  To: Simon Cruanes; +Cc: OCaml users

Simon's recent random-testing library release motivated me to finally
document and release a tiny library that had been collecting dust for
a few months now.

https://github.com/gasche/random-generator
http://gasche.github.io/random-generator/doc/Generator.html

random-generator is trying to answer the following question:
  "What is an elegant interface for random value generation?"

The focus is to get a combinator library where small, composable
combinators are composed to express rich behaviors. I tried hard to
choose type definitions that avoid duplication of concerns between the
various aspects of the library, building domain-specific notions of
random generation on top of a simple base layer in a modular way.

(Note that this focus is sometimes in tension with providing
convenient, derived functions that make user's code short and easy to
read. For now, random-generator will choose the "nice for the library
designer" way, and code may require some time learning the library to
be easy to read. You have been warned.)

The library currently provides three different pieces:

- a type ('a gen) for simple random generation
- a type ('a backtrack_gen) for generators that can fail:
  "generate a value such that this (possibly empty) condition is verified"
- a type ('a fueled) for generation of values with an inductive
  (tree-like) structure that looks nice to the human eye;
  see the documentation for more information on this:

    http://gasche.github.io/random-generator/doc/Generator.html#2_fueledgenerators

I consider the value of this library to be in its interface, not
necessarily its implementation. I think the current interface is solid
(though it can still be improved) and encourage people writing random
generators to steal and reuse it -- or at least feel inspired by it.


Closing remark: This design experiment started from Xavier Clerc's
inspiring Kaputt library ( http://kaputt.x9c.fr/ ), that got me
interested in random testing a few years ago. I have found random
testing to be very useful for various kind of projects
(random-generator was used to build a term generator for this year's
ICFP contest in a matter of minutes), and would encourage anyone to
consider using it to find the obvious bug in any fresh code
manipulating non-trivial data structures.

On Mon, Oct 7, 2013 at 10:35 AM, Simon Cruanes
<simon.cruanes.2007@m4x.org> wrote:
>
> Hello,
>
> I'm happy to announce the first release of a small QuickCheck
> implementation for OCaml, named `QCheck`. It consists in writing
> invariants as function t -> bool for some type t, and then checking that
> the invariant holds on randomly generated instances of t.
>
> QCheck is designed so that writing tests is as easy as possible[1],
> especially for Arbitrary instances (the part where you generate random
> values of a type) where it provides many combinators.
>
> The library requires OCaml >= 4.00.1, and is available under the BSD
> license on opam via:
>
>     $ opam install qcheck
>
> You can find documentation at:
> http://cedeela.fr/~simon/software/qcheck/QCheck.html
> source code at:
> https://github.com/c-cube/qcheck
> and some explanations here:
> http://cedeela.fr/quickcheck-for-ocaml.html
>
> Feedback or comments welcome!
> Cheers,
>
> --
> Simon
>
> [1] your mileage might vary ;)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] [ANN] random-generator 0.1 (Was: [ANN] QCheck 0.1)
  2013-10-25 14:51 [Caml-list] [ANN] random-generator 0.1 (Was: [ANN] QCheck 0.1) Gabriel Scherer
@ 2013-10-25 15:47 ` Gabriel Kerneis
  2013-10-25 15:57   ` Gabriel Scherer
  2013-10-29  0:55   ` Francois Berenger
  0 siblings, 2 replies; 4+ messages in thread
From: Gabriel Kerneis @ 2013-10-25 15:47 UTC (permalink / raw)
  To: Gabriel Scherer; +Cc: Simon Cruanes, OCaml users

Hi Gabriel,

On Fri, Oct 25, 2013 at 04:51:23PM +0200, Gabriel Scherer wrote:
> - a type ('a fueled) for generation of values with an inductive
>   (tree-like) structure that looks nice to the human eye;

Do you know about Boltzmann samplers/generators, and how they compare to
your "fueled" generators?

Best regards,
-- 
Gabriel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] [ANN] random-generator 0.1 (Was: [ANN] QCheck 0.1)
  2013-10-25 15:47 ` Gabriel Kerneis
@ 2013-10-25 15:57   ` Gabriel Scherer
  2013-10-29  0:55   ` Francois Berenger
  1 sibling, 0 replies; 4+ messages in thread
From: Gabriel Scherer @ 2013-10-25 15:57 UTC (permalink / raw)
  To: Gabriel Kerneis; +Cc: Simon Cruanes, OCaml users

[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]

> Do you know about Boltzmann samplers/generators, and how they compare to
> your "fueled" generators?

No. I made a mention of my deep ignorance of probability on combinatoric
structures in the documentation:

Remark: I have no idea what the distribution of terms generated used this
> technique is, and whether it is "uniform" -- probably not. I only found it
> very useful in practice.
>

(The wording should be changed to "surely not [uniform]". If you can't
prove it's uniform, it's not uniform.)

I think I don't have enough (time weighted by interest) to learn about this
stuff right now. But feel free to send me emails to convince me that it's
fascinating, or patches implementing better approaches.



On Fri, Oct 25, 2013 at 5:47 PM, Gabriel Kerneis <gabriel@kerneis.info>wrote:

> Hi Gabriel,
>
> On Fri, Oct 25, 2013 at 04:51:23PM +0200, Gabriel Scherer wrote:
> > - a type ('a fueled) for generation of values with an inductive
> >   (tree-like) structure that looks nice to the human eye;
>
> Do you know about Boltzmann samplers/generators, and how they compare to
> your "fueled" generators?
>
> Best regards,
> --
> Gabriel
>

[-- Attachment #2: Type: text/html, Size: 1857 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] [ANN] random-generator 0.1 (Was: [ANN] QCheck 0.1)
  2013-10-25 15:47 ` Gabriel Kerneis
  2013-10-25 15:57   ` Gabriel Scherer
@ 2013-10-29  0:55   ` Francois Berenger
  1 sibling, 0 replies; 4+ messages in thread
From: Francois Berenger @ 2013-10-29  0:55 UTC (permalink / raw)
  To: caml-list

On 10/26/2013 12:47 AM, Gabriel Kerneis wrote:
> Hi Gabriel,
>
> On Fri, Oct 25, 2013 at 04:51:23PM +0200, Gabriel Scherer wrote:
>> - a type ('a fueled) for generation of values with an inductive
>>    (tree-like) structure that looks nice to the human eye;
>
> Do you know about Boltzmann samplers/generators, and how they compare to
> your "fueled" generators?

There is also the pareto library from Sergei Lebedev if you are looking
for a statistics library:

https://github.com/superbobry/pareto

 From there:

pareto is an OCaml statistics library, based on GSL, which provides:
-Common statistical tests for significant differences between samples.
-Uniform interface for common discrete and continuous probability 
distributions.
-Sample statistics, quantile estimation, kernel density estimation.
-Resampling methods: jackknife, BCa bootstrap.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-29  0:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-25 14:51 [Caml-list] [ANN] random-generator 0.1 (Was: [ANN] QCheck 0.1) Gabriel Scherer
2013-10-25 15:47 ` Gabriel Kerneis
2013-10-25 15:57   ` Gabriel Scherer
2013-10-29  0:55   ` Francois Berenger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).