This is just a quicky to start off the day. I often write fatal error message using a combination of
Printf.eprintf ;; exit 1 ;; failwith ;; assert false ;; etc ...
Well ... it seems that planet ocaml is faster then light to index new pages... I often start editing one story to publish it few days later to avoid stupid mistakes. This time I published the page by accident and I think it stayed published for less then two minutes... This is the final versions ...
Today i did a small audit on my code to check which are the functions that are often used and can slow down my code. One in particular took my attention,
ExtLib.List.unique . This function (below) takes quadratic time on the length of the input list.
Often, when I change something in my project, I wonder if my modifications had any impact on other modules. On the one hand there is correctness. If I change something I want to be confident that I didn't break anything else in a dependent part of the code. In order to alleviate this problem, I often use a battery of unit tests that I ran before committing my changes. This does not give me a proof that I didn't break anything, but at least some level of confidence that if I broke something, this is not something I thought of before...
When developing ocaml applications I often need to load a bunch of libraries in my toplevel to test a small function. This can be a tedious task when you have a complex project and a lot of libraries installed in your system.
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.