Previous week Up Next week


Here is the latest OCaml Weekly News, for the week of May 27 to June 03, 2014.

  1. PG'OCaml 2.0
  2. Why AVL-tree?
  3. Other OCaml News

PG'OCaml 2.0


Dario Teixeira announced:
I'm happy to announce version 2.0 of PG'OCaml, a library offering type-safe
access to PostgreSQL databases for OCaml applications.

This version no longer depends on Batteries, which hopefully will entice more
Core users to give it a spin. Below is the list of the remaining changes,
straight from the changelog:

  * Dario Teixeira and Jacques-Pascal Deplaix: fixing issues with arrays.
    This requires all array types to change from 'a array to 'a option array,
    which breaks backward compatibility.
  * Dario Teixeira's patch making PostgreSQL's NUMERIC type be converted
    to/from OCaml strings.  This change is not backward's compatible,
    requiring a bump in the major version number (though there seems
    to be no actual code in the wild relying on the previous behaviour).
  * Dario Teixeira's patch adding function 'uuid', which exposes the
    unique connection handle identifier.
  * Jacques-Pascal Deplaix's patches adding 'catch', 'transact', 'alive',
    'inject', and 'alter' functions.

Note that a couple of changes break backward compatibility, hence the new
major version number.  These changes were required to fix some long-standing
issues, so I trust you'll be understanding.

This new release should be hitting OPAM soon.  Alternatively,
you can grab the source from the project's homepage:

Why AVL-tree?


Yoriyuki Yamagata asked and Xavier Leroy replied:
> Just from the curiosity, why balanced binary trees used in Set and
> Map are AVL-trees, not their alternative, say, red-black trees?  Is
> there a deep reason for it, or just a historical one?

At the time Set was written, no efficient algorithms for whole-set
operations (union, intersection, difference, etc) were known for
red-black trees.  I'm not sure they are known today.

As for performance of insert/lookup operations, Jean-Christophe
Filliâtre has measurements showing that OCaml's 2-imbalance AVL trees
perform better than red-black trees.  It all depends on your ratio of
insertions to lookups, of course.  But the 2-imbalance trick makes a
big difference with textbook AVL trees.

Other OCaml News

From the ocamlcore planet blog:
Thanks to Alp Mestan, we now include in the OCaml Weekly News the links to the
recent posts from the ocamlcore planet blog at

OCaml 4.02.0-beta:

PG'OCaml 2.0 released:

PG'OCaml 2.0 has been released:

Announcing PG'OCaml 2.0:

Full Time: Software Developer (Functional Programming) at Jane Street in New York, NY; London, UK; Hong Kong:

Old cwn

If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.

If you also wish to receive it every week by mail, you may subscribe online.

Alan Schmitt