Previous week Up Next week

Hello

Here is the latest Caml Weekly News, for the week of January 15 to 22, 2013.

  1. beta-release of OPAM
  2. Stog 0.6 is out
  3. Hash function: complexity and circular structures
  4. sedlex = ulex without camlp4
  5. Fan, a promising replacement of camlp4
  6. Job offer on formal methods (fixed term contract)

beta-release of OPAM

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-01/msg00073.html

Thomas Gazagnaire announced, spawning a huge thread:
I'm very happy to announce the beta release of OPAM (0.9.1). OPAM is a 
package manager for OCaml to install libraries and tools from source 
archives. It supports multiple simultaneous compiler installations, flexible 
package constraints, and a Git-friendly development workflow.

The goal of this beta release is to formally introduce OPAM to the community, 
to gather some general feedback on the documentation and tools and 
double-check that we've not forgotten some useful features. I would also like 
to use that opportunity to make an official call to maintainers: if you have 
developed packages which are already in OPAM do not hesitate to claim their 
ownership and to improve their description - if your packages are not yet in, 
it's time to start packaging them! 

OPAM is developed by OCamlPro[1] and has been in alpha release since June 
2012. It is already quite mature and has gained some nice momentum (+40 
contributors, +300 packages). OPAM has been initially funded by Jane 
Street[2] and the DORM EU research project, and it has received continuous 
help and resources from OCamlLabs[3].

The source code of OPAM is available on Github:
* installer: https://github.com/OCamlpro/opam
* packages and compiler descriptions: 
https://github.com/OCamlPro/opam-repository
* website: https://github.com/OCamlPro/opam2web

The documention:
* install instructions and tutorial are available http://opam.ocamlpro.com/
* the main source of documentation is 'opam --help' or 'opam <command> --help'
* user manual: 
https://github.com/OCamlPro/opam/raw/master/doc/dev-manual/dev-manual.pdf

You can report issues on github bug tracker:
* https://github.com/OCamlPro/opam/issues

The next steps for us is to focus on improving the package descriptions 
quality and the global consistency of 
https://github.com/OCamlPro/opam-repository. We will gladly accept any kind 
of help and support from the community to do this! We plan to announce the 
release of 1.0.0 in a couple of months, with improved package quality and 
better integration with the future OCaml platform.

Last point, if you are working in a company and that you already use OPAM, or 
plan to use OPAM, and you would like to help us ensuring it a sustainable 
future[2], you can contact us at 
contact AT ocamlpro.com.


On behalf of the OPAM team,
Thomas Gazagnaire

[1] http://www.ocamlpro.com/
[2] http://www.janestreet.com/
[3] http://www.cl.cam.ac.uk/projects/ocamllabs/
      
Anil Madhavapeddy then added:
If you're using Homebrew on the Mac, just do a "brew update" and you should 
get the latest beta release (0.9.1) via it. Enjoy!
      
Thomas Gazagnaire also added:
To people already using OPAM, I forgot to mention that it is highly 
recommended to NOT upgrade opam using opam. The auto-update thing was a 
mistake at the first place. It is also advised to start from a fresh opam 
init. It should work if you don't, but it would definitely avoid some 
confusions in some corner-cases.
      
Alan Schmitt asked and Fabrice Le Fessant replied:
> I'm thinking of trying it, but there was a bit of information I could
> not find on the web page: where does OPAM puts the things it compiles?
> Is it easy to just try it with an existing installation of ocaml &
> libraries?

OPAM installs everything in ~/.opam by default, so it won't pollute
your current installation of OCaml. You have to use:

eval `opam config -env`

in a terminal to start using the version of OCaml installed by OPAM
(you can put that in a .bashrc file, for example).
      

Stog 0.6 is out

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-01/msg00095.html

Maxence Guesdon announced:
It is my pleasure to announce that Stog 0.6 is available from
http://zoggy.github.com/stog/install.html

Stog is a kind of Jekyll in OCaml: It is a static web site generator,
able to handle blog posts as well as regular pages.
      

Hash function: complexity and circular structures

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-01/msg00113.html

Jean-Baptiste Jeannin asked and Nicholas Lucaroni replied:
> The default OCaml function (Hashtbl.hash) says that it "always
> terminates, even on cyclic structures.". I would be curious to know
> what its complexity is, both on a finite list and on a cyclic list
> (created by let rec l = 1 :: l for example). Is the algorithm that is
> being used published anywhere?
> 
> Also, this hashing function seems to be returning 0 on any cyclic list
> (at least the ones I tried). Is this normal? Does anyone know any
> better hashing function on cyclic lists?
> 
> # Hashtbl.hash [ 1 ; 2 ];;
> - : int = 131199
> # let rec ones = 1 :: ones;;
> val ones : int list =
> [1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 
> 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 
> 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 
> 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 
> 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 
> 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 
> 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 
> 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 
> 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 
> 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 
> 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 
> 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1;
> ...]
> # Hashtbl.hash ones;;
> - : int = 0
> # Hashtbl.hash (5 :: 4 :: ones);;
> - : int = 0

https://sympa.inria.fr/sympa/arc/caml-list/2011-07/msg00117.html

That thread talks about the previous and a better alternative (which is in 4.x).

Xavier had said,
The SVN trunk for OCaml contains a complete reimplementation of the
generic hash function that addresses both issues: lists and other
complex keys are traversed breadth-first in a more cautious manner
than before, and the mixing functions are based on MurmurHash 3, which
exhibits very good statistical properties.  All this should go in the
next major release 3.13.  So, everyone with an interest in efficient
hash tables is welcome to try the trunk sources and let me know of any
problems encountered.
      

sedlex = ulex without camlp4

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-01/msg00135.html

Alain Frisch announced:
I'd like to announce the first public release of sedlex, a
Unicode-friendly lexer-generator. It is the successor of ulex, which
was implemented as a Camlp4 syntax extension. sedlex is now based on
the new -ppx feature and consequently requires a very recent
development version of OCaml.

Homepage: http://www.lexifi.com/sedlex

sedlex is available as an OPAM package, to be installed after
switching to 4.01.0dev+trunk ("opam switch 4.01.0dev+trunk").
      

Fan, a promising replacement of camlp4

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-01/msg00147.html

Bob Zhang announced:
Fan (https://github.com/bobzhang/Fan) is a dialect of ocaml for
meta-programming, though it's still under active development, but I
think I have done something right, so I would be happy to share some
encouraging results.
Besides the engineering part(Fan is much much faster than
camlp[4,5], with numerous bug fixes, nested quotation-antiquotation,
pluggable lexer, etc), the main contribution lies in 3 parts:
First, Fan uses polymorphic variants to encode the intermediate Ast;
Second, Fan supports first class programmable grammar/lexer,
Third, Fan has a strong built in customizable deriving support.

First. variants hit the sweet spot here, (don't worry about the
error message, since we provide a quasi-quotation mechanism, so for
a large ast, the user don't construct the Ast by hand).
The benefit is *huge*,
a. shared constructor branches
A lot of code re-use and much cleaner API here, think
about if you need a function which takes the location
from the Ast node, in Camlp4, you have to write loc_of_expr
or loc_of_patt, to make things worse, once you choose loc_of_expr,
the function can only apply to expr, no code re-use anymore,
now in Fan, you only need loc_of, it can apply to all
syntax categories,
(btw, loc_of is derived automatically :-))

b. subtyping makes program analysis easier
if you pick a subset of ocaml to mixin with your own
DSL,subtyping
makes you only need to analyze part of the language with much
more type safety.
c. overloaded quosi-quotation
We provides two Asts for quasi-quotation, one with the
location, the other without location(for code
generation), they works
well together. And the user can also enrich the
intermediate Ast with
a new constructor while re-use the existing quotation kit.
d. minimum dependency
Since the namespace of variants is global, we provide a
mechanism to store the ast in a normal ocaml value, this adds
reflection layer to ocaml automatically while without
introducing any
dependency. Besides, unlike camlp4,
the global namespace also makes the semantics correct

Second, we provides the first class programmable parser/lexer.
The grammar is not only dynamically extensible, but you can also
program the productions as well. This is much different from yacc or
menhir, here grammar is programmable means you can parameterize any
production.

Third, we provides a uniform deriving mechanism
Take a look at the code in src/FanAst.ml
{:fans|keep off; derive (Map2 Fold2 OIter MetaExpr
MetaPatt Map Fold Print OPrint OEq GenLoc Strip ); |};
{:ocaml|INCLUDE "src/Ast.ml"; |};
This will derive the map2, fold2,oiter objects, and metaexpr
metapatt lifting, map, fold, pretty printer, strip location for
FanAst, the deriving can be customized in tens of lines code.

There are a number of enhancements I don't mention here, it
would be very helpful that you could suggest what kind of
functionality you want, Fan is already much better than camlp4 in all
rounds, it is still at alpha stage, so your opinions matter a lot :-)
      

Job offer on formal methods (fixed term contract)

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-01/msg00151.html

David Mentré announced:
My company is looking for an Engineer or PhD in formal methods to work
on railway systems. It is research activity with model and software
development and proving properties on them.

More details in French:

http://www.fr.mitsubishielectric-rce.eu/images/fck_upload/1301_Annonce_COM_Formal_Methods_MERCEFRCOM0113_FR.pdf

Feel free to forward this offer to people you know who might be interested.
      

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