From: Didier Le Botlan <caml-list.lebotlan@antichef.net>
To: caml-list@inria.fr
Subject: [Caml-list] [ANN] exenum.0.6: exhaustive enumerations for datatypes
Date: Tue, 12 Nov 2013 15:00:57 +0100 [thread overview]
Message-ID: <52823499.9090901@antichef.net> (raw)
Hi list,
Let me introduce exenum, the "exhaustive enumeration"(1) library.
<shameless teaser>
You all probably wonder what "the" 42,000th lambda-term is. It happens
to be (((fun x -> v) (v v)) ((x x) v)) (2)
As for "the" 10^400th lambda-term, it is
((((((fun x -> (v v)) ((fun v -> y) (fun x -> x))) ((fun v -> (x
x))[...and 20 more lines...]
(1) where "exhaustive" means that every value (of the given datatype) is
eventually enumerated.
(2) where variables are restricted to "x", "y", "u", "v".
</teaser>
In short :
- exenum makes it easy to build enumerations for any datatype.
- Very handy to carry out intensive unit testing
(Students' motto : "If you know your code is unsound, test it anyway, it
might work by accident").
- exenum is inspired by FEAT for Haskell.
- Impress coq's users with statements such as: "I have successfully
checked my code up to index 17 !"
- Quick overview and API on the homepage:
http://exenum.forge.ocamlcore.org/
- Install with: opam install exenum
* * *
As a side dish, let me mention the oasis- and ocamlbuild-based packaging
I used for this library.
For quite a while, I had been looking for a neat way to pack an ocaml
library, that is:
- Only one main module is "exported" to users (or, say, just a couple
of modules).
- The library may define several internal modules, but they should
remain hidden (that is, as hidden as possible). In particular, they
should not pollute the global module namespace.
I was not able to find satisfactory examples on the net (most likely,
though, I have not searched enough).
Finally, I wrote an _oasis file as follows (excerpt):
## Exported library
Library "exenum"
Path: src/
Modules: ExEnum
BuildDepends: exenum.internals
Install: true
## This library packs internal modules, so that they may not conflict
with anything else.
Library "exenum_internals"
Path: src/
Modules: Convenience
InternalModules: Exen, ExtArray, Parts, Shuffle
FindlibParent: exenum
FindlibName: internals
Pack: true
Thus, the internal modules are all packed in an ocaml module
"Exenum_Internals" (the -pack option of ocamlc). Only the main module
"ExEnum" and "Exenum_internals" are visible at top-level.
See details at the bottom of:
http://exenum.forge.ocamlcore.org/
--
D. Le Botlan
reply other threads:[~2013-11-12 14:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52823499.9090901@antichef.net \
--to=caml-list.lebotlan@antichef.net \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox