
This work is licensed under a Creative Commons Attribution-Share Alike 2.0 France License.
Honestly ocaml format module is a royal PITA to use. The only documentation apart the reference manual is this document here. Don't get me wrong. I think it's a very nice piece of software and absolutely worth having it in the stdlib, but it simply not intuitive (at least for me) to use at the first glance. I'll write down a couple of example.
A long time ago I wrote about how to handle compressed files in ocaml using extlib : http://mancoosi.org/~abate/transparently-open-compressed-files-ocaml
Today I got back to it and added bz2 support. The code is trivial. The only small problem to notice is that since the bz2 interface does not support a char input function, I've to simulate it using Bz2.read. A bit of a hack. I want to look at the bz2 bindings to fix this small shortfall.
I've taken some time off to finish the ocaml bindings to Buddy BDD.
The code is on github . Get in touch if you find this useful.
Release early, release often !
I've been working with Falvio Lerda to update the ocaml binding to minisat2.
The biggest change from Fabio's original version is the object oriented interface (mimicking the library c++ interface) and the addition of a couple of bindings.
You can find the git repo here.
A while ago I wrote about the Bron - kerbosch algorithm giving a brain dead implementation based on simple lists. Of course since the amount of maximal cliques can be exponential in the size of graph, my previous implementation is useless on big graphs (say more then 80 nodes and 150 edges). It just takes forever.
Now I give a more efficient version of the algorithm that uses a simple lazy data structure to hold solution.
I've already wrote something about OptParse last month. Today I discovered how to create a new option (that is not a string, int or bool) and validate it within the arg parser.
So suppose we want to write an application that can output both txt and html and we want the user to specify the format with command line option. One way would be to use a StdOpt.str_option - eventually with a default option - and to retrive it in application code with OptParse.Opt.get.
Every now and then I need to write a simple combinatorial algorithm. Using monads this is fairly easy and concise, but probably not the fastest way to do it. We start with the definition of a few functions in terms of the List module. The function themselves are kinda of self explanatory.
A small ocaml implementation of the Bron–Kerbosch algorithm to list all maximal cliques in an undirected graph. The description of the algorithm is on wikipedia. http://en.wikipedia.org/wiki/Bron–Kerbosch_algorithm . The example given is the same as in the wikipedia page.
I recently discovered the extLib OptPase module [1] . It's a very nice and complete replacement for the good old Arg in the standard library. I'm gonna give a small example on how to use it. I hope this can be useful to somebody.
I first build an Option module to clearly separate the options handling from the rest of my program. To keep it short we add only two options, debug and output. Debug has a short and long option, output is only a string.
Recent comments
2 weeks 4 days ago
22 weeks 6 days ago
1 year 23 weeks ago
1 year 27 weeks ago
1 year 40 weeks ago
1 year 41 weeks ago
1 year 44 weeks ago
1 year 46 weeks ago
1 year 48 weeks ago
2 years 25 weeks ago