Previous week Up Next week


Here is the latest OCaml Weekly News, for the week of November 03 to 10, 2015.

  1. Do we have a B-tree implementation in ocaml?
  2. ocaml-amqp 0.0.1
  3. containers 0.14
  4. Other OCaml News

Do we have a B-tree implementation in ocaml?


Francois Berenger asked and Frédéric Bour replied:
> Hello, I am looking for even a simple implementation with at least the
> following operations: insert/add, remove, mem/contains and at_rank. The
> at_rank is especially important since it is inefficient to implement it
> using fold in a set like the ones from the stdlib.

If I understand well, you want an efficient rank function on a sequence, you
are not particularly interested in B-trees.

I have an implementation of balanced trees you might be interested into:

It is a binary tree with a smart constructor to ensure only balanced trees are
Beside that, no other constraints are applied. In particular these are not
search trees although those can easily be implemented on top.

O(1) access to the size (number of items) is provided, and as such an O(log n)
rank function.

Performance is also quite competitive: although I did not push the code yet, I
implemented Map and Set from the standard library using these trees. On a
small set of benchmarks I ran, these were at worst 10% slower than the
standard ones.

ocaml-amqp 0.0.1


Continuing the thread from last week, Marek Kubica asked and Anders Peter Fugmann replied:
> Could you explain how it differs from netamqp? I see Issuu seems to
> maintain a fork of netamqp that runs on current OCaml versions.

The major difference is that netamqp is based on ocamlnet's async event system
whereas Ocaml-amqp is based on Core Async.

The bindings not only exposes the AMQP 0-9-1 protocol, but also
tries to give the developer a higher abstraction layer for using standard Amqp

The library is written in my spare time, and has not yet been battle tested in
a production environment (Although I expect this to happen soon).

Please be aware that even though I do not expect major changes to the API, the
library is still in heavy development. Please send feedback, including
suggestions on the API so that these can be incorporated into the next

> Also, are there plans to have an Lwt backend as well, in a similar way
> to Cohttp?

That is currently not a priority. I was considering it when I started though.

containers 0.14


Simon Cruanes announced:
I have the pleasure to announce that version 0.14 of containers has been
released and is available on opam. The change log can be found at .

Containers has been steadily growing and improving during the past year,
with a cleaner code, many more tests, functions and more benchmarks. The
documentation page (
gives an overview of all the available modules. The core library,
designed as an extension to OCaml's standard library, has no additional
runtime dependency but base-bytes and should therefore be usable from
within js_of_ocaml or Mirage; moreover, every module is independent.

The mailing list for questions, ideas, and other discussions about
containers is: . Bugs or feature
requests should be submitted on or, for github skeptics, on
the mailing list.

Although the library is getting more and more stable, it has not reached
1.0 yet. It is possible that a large breaking change will occur before
1.0; namely, adding labels to many functions. Any feedback about this
change is welcome.

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

Andrej Bauer: Agda Writer

Github OCaml jobs: 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