[cwn] Attn: Development Editor, Latest Caml Weekly News

Alan Schmitt alan.schmitt at polytechnique.org
Tue Oct 2 00:39:00 PDT 2007


Hello,

Here is the latest Caml Weekly News, for the week of September 25 to  
October 02, 2007.

1) I'm looking for an OCaml book
2) Ocaml for Scientific computing
3) OCaml Reins 0.1 - Persistent Data Structure Library
4) Camlp5 5.00
5) LablGtk 2.10.0
6) Weaktbl: a weak hash table library

========================================================================
1) I'm looking for an OCaml book
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
eb4d052bf88a0c33/375f3ef0b7003049>
------------------------------------------------------------------------
** Continuing this thread, Xavier said and Mathias Kende  answered:

 > While developping OCaml-Java, I had to reverse-engineer this
 > information.
 > I produced two pdf files available at <http://cadmium.x9c.fr/>
 > downloads.html :
 >    - caml-formats.pdf describes both the marshalled data format  
and the
 > bytecode file format;
 >    - caml-instructions.pdf describes all the instructions used by the
 > OCaml VM.

Thank you, this is exactly what I was looking for. Someone also gave a
link to this page in an answer not forwarded to the list (I send it here
for references):
<http://cristal.inria.fr/~lebotlan/docaml_html/french/> or
<http://cristal.inria.fr/~lebotlan/docaml_html/english/>
			
========================================================================
2) Ocaml for Scientific computing
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
12305535fd0e4a1d/76ff997f5d964f22#76ff997f5d964f22>
------------------------------------------------------------------------
** Alex Mikhalev asked and Erik de Castro Lopo answered:

 > I am wondering is anyone using Ocaml for scientific computing?

Yes.

 > I didn't
 > mean parsing, but for number crunching applications, like signal/ 
image
 > analysis.

Yes. I'm working on code for audio digital signal processing and
function optimisation. I also wrote my own simple computer algebra
system.

 > Is it suitable for this kind of tasks in general?

Much better than C or C++ or GNU Octave.

 > I have read "Ocaml for Scientists" and although it gave me some very
 > good ideas, I didn't manage to repeat a number of examples with  
modules
 > from this book. I had a problem compiling or using scientific modules
 > (lacaml, fftw, some others) on linux and macosx and since some of  
these
 > modules look like someones graduate project,

I've looked at lacaml and didn't find any particular problems. The ocaml
fftw module was a little more problematic but I resolved the problem in
the end.

I would like to hear from

 > people practically using ocaml for mathematical simulations or  
analysis.
 > Preferable with OS, modules, problems encountered.

I'm doing this on Ubuntu Linux, I usually use package distributed by
Ubuntu but will compile my own from source if I need to.
			
** Jon Harrop said:

 > I've looked at lacaml and didn't find any particular problems. The  
ocaml
 > fftw module was a little more problematic but I resolved the  
problem in
 > the end.

I found Christophe's latest version fftw3 from sourceforge CVS to be  
easier to
use and very capable. One feature I would like is the ability to use  
ordinary
float or Complex.t arrays rather than big arrays. I'd also like better
integrated support for complex numbers in OCaml...
			
** Hezekiah M. Carty answered the OP:

I am using OCaml for atmospheric/meteorological research.  I started
using it about a year ago, and feel that it has been the right tool
for the job.  My work so far has involved manipulating and analyzing
satellite data sets.  OCaml has been quite fast computationally, and
the strict type checking and type inference have helped to eliminate
several sources of error.

I've used the OCaml GSL bindings and toyed around with some of the
plotting modules available (gnuplot, mlgrace, OVT, plplot,
camlimages, the included Graphics module).  The code has been used
and developed under Ubuntu, Debian and CentOS.  I currently use Godi
for my OCaml installation because it makes it easier to keep things
in my home directory if I don't have root access to a system.

The biggest problem I've faced with OCaml has been missing
libraries.  The data I'm working with is (almost) all in HDF format,
so I had to write my own library bindings for OCaml.  The other is
a library for plotting data - but that is largely due to a lack of
time spent on my part.  That said, I've found writing bindings to C
libraries in OCaml much nicer than other languages I've tried.

An example of an older number crunching/scientific tool using OCaml
is Psilab - <http://psilab.sourceforge.net/>
However, it does not seem to be maintained by its author any more.
I have updated the code slightly so that it builds with newer GCC
versions if you have any interest in that.

Good luck with your work!  I highly recommend OCaml, both for
selfish reasons - to bring more number-crunching oriented users in
to the community - and because it is an excellent tool for the job.
			
** Jon Harrop answered and Markus E L said:

 > > The biggest problem I've faced with OCaml has been missing
 > > libraries.  The data I'm working with is (almost) all in HDF  
format,
 > > so I had to write my own library bindings for OCaml.  The other is
 > > a library for plotting data...

 > While this is a general purpose graphics library rather than a  
plotting
 > library, you may be interested in our hardware-accelerated vector  
graphics
 > library Smoke:

 >   <http://www.ffconsultancy.com/products/smoke_vector_graphics/?ol>

 > Smoke makes it much easier to write visualization software.


Nothing against Smoke, but on a Unix/Linux platform it might just be
useful to use Ocaml to calculate the graphics data and pipe that to
another process, e.g. one of the well known scientific visualization /
graphing packages (starting with gnuplot, but there have been others
too). For practical work (not advertising), that spares one to do all
that tricky stuff like placing labels or ticks on the axis yourself.

BTW: What I'd consider a boon for scientific visualization, actually,
would be to output SVG to a file. Such an SVG file could be annotated
with a usual graphics editor like inkscape for publication: Very
valuable (if you don't need interactive visualization).
			
** Jon Harrop answered the last point:

Absolutely. The full version of Smoke actually already does this but  
the free
version does not.
			
** Hezekiah M. Carty also answered this:

This is one of the things about the OCaml Visualization Toolkit
(one of the Jane St. summer projects).  It is built around
cairo-ocaml, which in turn supports SVG output.

OVT is still somewhat incomplete, but its output is already quite
attractive thanks to the Cairo backend.  SVG output is one of the
items still missing from OVT, and I do not know what plans exist to
maintain this library.  But with that addition it would be an
immensely useful tool for scientific plots, among other things.
I've already used OVT for a few simple presentation figures.
			
** Mike Lin answered the OP:

I use it for a lot of genome sequence processing, comparative genomics
and phylogenetic modeling. Algorithmically this involves conditional
random fields (for which I have my own library) and some linear
algebra and numerical optimization (for which I use Lacaml and
ocamlgsl). I had a lot of frustrations at first, but it's been better
since we got exception stack traces and ocaml+twt.

For numerical computing, I wish ocamlopt would do at least basic loop
optimizations, like hoisting invariant values -- this type of stuff is
easily done manually, but often at the expense of code readability. I
can see how this may be a bottomless pit for the dev team though,
since I would probably always feel like we are one crucial
optimization short of not having to rewrite that tight loop in C.

In any case though, I work in a group where everyone else uses Python,
so I'm already beating their pants off :o)
			
** Jan Kybic also answered the OP:

I have used Ocaml for several projects involving numerical
calculations, including image processing, boundary element methods and
optimization. I use Lacaml, fftw, MPI and Gsl libraries, the
installation was not difficult.  Ocaml has performed very well for me
so far, it is faster than Python or Matlab and more "friendly" than
C/C++. Some minor issues:

- There is too many different representations of vectors and matrices:
   float arrays, plain big arrays, Lacaml Fortran style big arrays,
   several kinds of Gsl vectors with yet separate styles. I found I
   often had to convert vectors or matrices from one format to another
   because the function I wanted to use was available for a different
   interface.

- Limited interactivity - it would help if you could call native  
compiled
   modules from the toplevel.

- Limited debugging - it is not possible to debug compiled modules.
   I would like to see an interface to gdb (I work on Linux), or a
   possibility for the byte compiled code being debugged to call
   natively compiled modules.

- I still find Ocaml object system less natural for me and more
   limiting than for example Python's. Also, often you can do the same
   thing with the objects as with the module system, so the choice of  
the
   best design pattern is sometimes not obvious at the first sight and
   requires a lot of foresight. But I assume this is just a matter of
   practice.
			
========================================================================
3) OCaml Reins 0.1 - Persistent Data Structure Library
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
cca83b3fc755dfe8/a58385b41264b0a8#a58385b41264b0a8>
------------------------------------------------------------------------
** Mike Furr announced:

I'm happy to announce the first source release of the OCaml Reins data
structure library available at:

    <http://ocaml-reins.sourceforge.net>

This project started as an "OCaml Summer Project" and is now continuing
its development on sourceforge.  The library already contains several
implementations of persistent data structures and will continue to grow
(possibly adding ephemeral data structures at some point if there's
interest).

Features of this release include:
    * List data types:
       o Single linked lists (compatible with the standard library type)
       o O(1) catenable lists
       o Acyclic double linked lists
       o Random access lists with O(1) hd/cons/tl and O(log n)
         lookup/update
    * Double ended queues
    * Sets/Maps with both polymorphic and monomorphic keys/values
       o AVL
       o Red/Black
       o Big-endian Patricia
       o Splay
    * Heaps:
       o Binomial
       o Skew Binomial
    * Zipper style cursor interfaces
    * Persistent, bi-directional, cursor based iterators (currently only
      for lists and sets)
    * All standard types hoisted into the module level (Int, Bool,  
etc...)
    * A collection of functor combinators to minimize boilerplate
      (e.g., constructing compare or to_string functions)
    * Quickcheck testing framework
       o Each structure provides a gen function that can generate a  
random
         instance of itself
    * Completely safe code. No -unsafe or references to Obj.*
    * Consistent function signatures. For instance, all fold functions
      take the accumulator in the same position.
    * All operations use no more than O(log n) stack space (except for a
      few operations on splay trees which currently have O(log n)  
expected
      time, but O(n) worst case)
			
** Mike Furr later added:

Several people emailed me about the problems with the LGPL and static
linking.  So, I have released a new version (0.1a) whose only change is
that it adds a linking exception to the LGPL in the exact same spirit of
INRIA's own exception.
			
** Later on in the thread, Daniel Bünzli said and Maxence Guesdon  
suggested:

 > While I really like having a central repository and unification of
 > conventions I do like cherry-picking and embedding my modules.
 > Nevertheless I understand and respect your point, maybe it is a
 > matter of opinion/taste. But I'll explain why I like picking.
 > [...]

You might be interested in caml-get:
   <http://pauillac.inria.fr/~guesdon/camlget.en.html>
			
========================================================================
4) Camlp5 5.00
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
c7bd9e0fdb7ed065/5355c6d35fa4b8f7#5355c6d35fa4b8f7>
------------------------------------------------------------------------
** Daniel de Rauglaudre announced:

New release of Camlp5.
Version number is 5.00.

Camlp5 is a preprocessor-pretty-printer of ocaml.
It is compatible with OCaml versions from 3.08.1 to 3.11 included.

Available at:
   <http://pauillac.inria.fr/~ddr/camlp5/>

Main changes:
   - added 'q_ast.cmo' a quotation kit for syntax trees in user syntax
   - ability to use IFDEF in constructors definitions and match cases
   - many bug fixes and small improvements
   - more documentation

See file CHANGES for details.

Warning: there are two modes, resulting two different Camlp5  
installations:
   - 'transitional' mode: the abstract syntax tree is compatible with
       the previous version, but 'q_ast.cmo' is not usable.
   - 'strict' mode: the abstract syntax tree is different and q_ast.cmo
       can be used.

The mode must be selected at configuration time (default =  
transitional).
See the documentation.
			
** Richard Jones asked and Daniel de Rauglaudre answered:

 > 3.11?

Yes: it is the version of the current OCaml sources under CVS.
			
========================================================================
5) LablGtk 2.10.0
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
ae5bf9be088f66e6/3b16db9a267ad4f1#3b16db9a267ad4f1>
------------------------------------------------------------------------
** Jacques Garrigue announced:

After close to two years of development, here is a new release
of LablGtk2, the ocaml interface to the Gtk+2 GUI library and
friends (glade, rsvg, gnomecanvas, gnomedruid, panel, gtkspell,
gtksourceview.)

This release is based on the gtk+-2.10.x series, hence the name.
But it will work with older versions too.

You can find it at:

   <http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk.html>

There is a (semi-)binary releases for windows, with glade and
rsvg support, that can be used directly with the OCaml MSVC or mingw
ports. ocamlopt is supported too.

There are no major changes, but a number of bugs have been fixed,
and some new widgets are interfaced (GtkMenuToolButton and
GtkAssistant.)

The LablGtkSourceView code was contributed by Stefano Zacchiroli
and Maxence Guesdon.
			
========================================================================
6) Weaktbl: a weak hash table library
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
64e3bd4ff4ad7699/966777a90a9da8b6#966777a90a9da8b6>
------------------------------------------------------------------------
** Zheng Li announced:

I remember weak hash table was discussed on the list not long ago. I  
once ran
into a situation where weak data structure was desired, and came up  
with this
small module. Though I didn't really get a chance to make use of it  
(I turned
to another solution laterly), I'd like to share and hope it would be  
useful to
others.

== Description ==

Weaktbl is yet another weak hash table library for OCaml. Its main  
features
include:

* Both keys and associated values are weakly stored. A binding exists  
until
    the key is no longer referenced anywhere
* The implementation is built upon the hash table functor of Weak  
library
    rather than implemented from scratch, so it's rather small
* The interface is fully compatible with the standard Hashtbl library  
instead
    of the hash sub-module of the Weak library, so basically you can  
also use it
    as an alternative of the standard Hashtbl
* Its behaviors also follow the standard Hashtbl library's conventions.
    E.g. the "binding orders" and the "current binding" concepts all  
make
    sense here (with find/find_all/remove/replace/iter/fold etc.)

Link: <http://www.pps.jussieu.fr/~li/software/index.html#weaktbl>
			
========================================================================
Using folding to read the cwn in vim 6+
------------------------------------------------------------------------
Here is a quick trick to help you read this CWN if you are viewing it  
using
vim (version 6 or greater).

:set foldmethod=expr
:set foldexpr=getline(v:lnum)=~'^=\\{78}$'?'<1':1
zM
If you know of a better way, please let me know.

========================================================================
Old cwn
------------------------------------------------------------------------

If you happen to miss a CWN, you can send me a message
(alan.schmitt at polytechnique.org) and I'll mail it to you, or go take  
a look at
the archive (<http://alan.petitepomme.net/cwn/>) or the RSS feed of the
archives (<http://alan.petitepomme.net/cwn/cwn.rss>). If you also wish
to receive it every week by mail, you may subscribe online at
<http://lists.idyll.org/listinfo/caml-news-weekly/> .

========================================================================

-- 
Alan Schmitt <http://alan.petitepomme.net/>

The hacker: someone who figured things out and made something cool  
happen.
  .O.
  ..O
  OOO


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.idyll.org/pipermail/caml-news-weekly/attachments/20071002/3233f7c1/attachment.pgp 


More information about the caml-news-weekly mailing list