Previous week Up Next week

Hello

Here is the latest OCaml Weekly News, for the week of March 15 to 22, 2016.

  1. automatic differentiation
  2. opam-cross-windows
  3. Sundials/ML 2.6.2
  4. ocaml-ctypes 0.5.0, a library for calling C functions directly from OCaml
  5. Other OCaml News

automatic differentiation

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2016-03/msg00223.html

Nils Becker asked:
i was looking for an AD library for ocaml. what i found was this:

http://wmfarr.blogspot.de/2006/10/automatic-differentiation-in-ocaml.html

is this the state of the art of what's available today?

thanks for any pointers!
      
Yaron Minsky replied:
Markus Mottl has something that sounds pretty cool.

http://www.composeconference.org/2016/speakers/

But I have yet to find the code.  Markus, is your new ad package going
to be open sourced at some point?
      
Markus Mottl replied:
there are no imminent plans to make a release of the code for AD-OCaml
yet.  I'm still working on it, and once it reaches a sufficient level
of maturity, I'll determine what the next step will be, making it open
source being one of the options.
      
Guillaume Hennequin also replied:
I agree, it sounds really useful! I gave a shot at AD in OCaml a couple of
months ago, with inspiration coming from F#'s autodiff by Barak Pearlmutter
http://diffsharp.github.io/DiffSharp/ . I got to a working implementation of
forward/reverse/forward-on-reverse but I really struggled with the complexity of
the functorial interface I needed to achieve compositionality -- lack of
operator overloading somehow makes life difficult here. So really curious to see
Markus Mottl's solution. Happy to share my code with anyone interested though.
      

opam-cross-windows

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2016-03/msg00226.html

Continuing a thread, Andreas Hauptmann said:
> Ideally I would like to have an opam running on plain windows,

I (sometimes) maintain a windows repository for opam and an opam build
at: https://github.com/fdopen/opam-repository-mingw/

To a certain extent, it is "plain windows": neither opam nor OCaml are
linked against cygwin. However, cygwin is still necessary for nearly
everything else: git, rsync, a shell to run configure scripts, make, ...
      

Sundials/ML 2.6.2

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2016-03/msg00253.html

Timothy Bourke announced:
We are pleased to announce a new release of Sundials/ML, an OCaml
interface to the Sundials suite of numerical solvers (CVODE, CVODES,
IDA, IDAS, ARKODE, KINSOL).

This release includes support for all new features in Sundials 2.6.x
(namely the ARKODE solver, OpenMP and Pthreads nvectors, sparse
matrices, and the KLU and SuperLU/MT linear solvers), but continues to
work with the older version (2.5.0) that is still provided by many
packaging systems.

Information and documentation: http://inria-parkas.github.io/sundialsml/
Source code (BSD):             https://github.com/inria-parkas/sundialsml

    opam install sundialsml   # (requires Sundials 2.5.0 or above)

There is a draft report that describes our implementation. It is not
quite ready for public release, but we would be happy to share it by
private mail.

We gratefully acknowledge the original authors of Sundials, and the
support of the ITEA 3 project 11004 MODRIO (Model driven physical
systems operation), Inria, and the Departement d'Informatique de
l'ENS.

Timothy Bourke, Jun Inoue, and Marc Pouzet.
      

ocaml-ctypes 0.5.0, a library for calling C functions directly from OCaml

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2016-03/msg00255.html

Jeremy Yallop announced:
I'm pleased to announce release 0.5.0 of ocaml-ctypes, which is now
available on OPAM.

== About ocaml-ctypes ==

The ocaml-ctypes library makes it possible to call C functions from
OCaml without writing any C code.  The core of the library is a set of
combinators for describing C types -- scalars, functions, structs,
unions, arrays, and pointers to values and functions.  Type
descriptions can then be used to bind native functions and values.
Here's a simple example:

    # let puts = foreign "puts" (string @-> returning int);;
    val puts : string -> int = <fun>
    # puts "Hello, world!";;
    Hello, world!

Ctypes includes many more features, including functions for retrieving
constants, values and details about object layout from C, a way of
building C libraries from OCaml modules, and a variety of binding
strategies such as dynamic linking and static stub generation. Further
information is available at the links below:

  Tutorial: https://github.com/ocamllabs/ocaml-ctypes/wiki/ctypes-tutorial
  Examples: https://github.com/ocamllabs/ocaml-ctypes/tree/master/examples
  Some packages using ctypes:
http://opam.ocaml.org/packages/ctypes/ctypes.0.5.0/
  API documentation: http://ocamllabs.github.io/ocaml-ctypes/
  Github repository: https://github.com/ocamllabs/ocaml-ctypes
  Direct download:
https://github.com/ocamllabs/ocaml-ctypes/archive/0.5.0.tar.gz

== Selected new features in 0.5.0 ==

* Improved support for various standard C and POSIX integer types
  (time_t, ssize_t, ptrdiff_t, intptr_t, uint8_t, and many more).

* Improved support for conversions between function pointers and other
pointer types

* Support for releasing the runtime lock in the Cstubs_inverted module.

* An experimental interface for managing OCaml roots.

See the release notes for the full list of changes:

    https://github.com/ocamllabs/ocaml-ctypes/blob/0.5.0/CHANGES.md

== Thanks ==

I'm grateful to Andreas Hauptmann, David Sheets, Etienne Millon,
Goswin von Brederlow, Leonid Rozenberg, @orbitz, Max Mouratov, and
Peter Zotov for contributions to this release.
      
sp asked and Jeremy Yallop replied :
> Great work, thank you!
>
> Are there areny plans to support C++ in a similar approach?

It'd be possible to support some of C++ fairly straightforwardly.  For
example, binding overloaded functions should work with the current
ctypes release if you use stub generation (i.e. the Cstubs module),
and calling function templates will probably work too.  It'd be a bit
more work to support exceptions and member functions, but it could
probably be done.  C++ support is not currently high up on the
priority list, but I'd be happy to help out if someone wanted to start
looking at a design.
      
Goswin von Brederlow asked and Jeremy Yallop replied:
> Does anyone have an example of using ctypes with stub generation using
> oasis?

OPAM suggests that there are a few:

$ comm -12 <(opam list --short --depends-on oasis) <(opam list --short
--depends-on ctypes)
flock
nocrypto
ocephes
sanlock
tsdl-image
zstd

Here's the link to the homepage for the first result, which has some
oasis and ocamlbuild rules for ctypes stub generation:

$ opam show -f homepage flock
https://github.com/simonjbeaumont/ocaml-flock
      

Other OCaml News

From the ocamlcore planet blog:
Here are links from many OCaml blogs aggregated at OCaml Planet,
http://ocaml.org/community/planet/.

Format All the Data Structures
 http://cedeela.fr/format-all-the-data-structures.html

Unraveling of the tech hiring market
 https://blogs.janestreet.com/unraveling/?utm_source=rss&utm_medium=rss&utm_campaign=unraveling

A Machine Made this Book: Ten Sketches of Computer Science
 http://ocaml-book.com/blog/2016/3/17/0ejuvraprnf0mrt8cfjmn2yyb6ncdg
      

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