Caml Weekly News Previous week Up Next week

Hello

Here is the latest Caml Weekly News, for the week of March 20 to 27, 2007.

  1. ledit 1.13 + mlrogue 1.00
  2. One-year INRIA post-doctoral position
  3. wiki for libraries comparisons
  4. documentation for building C++ libraries with ocamlbuild
  5. [Camlp4 3.10] The rosetta stone

ledit 1.13 + mlrogue 1.00

Archive: http://groups.google.com/group/fa.caml/browse_frm/thread/8e3ae4b401a05d4b/ac59f60a45b43f4a#ac59f60a45b43f4a

Daniel de Rauglaudre announced:
New version 1.13 of ledit. Ledit is a text editor allowing to edit lines 
while using an interactive command (e.g. the ocaml toplevel). Change: Added 
option -u to allow using utf-8 encoding. 

   http://pauillac.inria.fr/~ddr/ledit/ 

New version 1.00 of mlrogue. MLrogue is a clone of rogue, a game of the 
80ies running in a terminal 24x80 (e.g. an xterm). Change: minor fixes 
and improvements. Work well after months of testing. 

   http://pauillac.inria.fr/~ddr/mlrogue/
			

One-year INRIA post-doctoral position

Archive: http://groups.google.com/group/fa.caml/browse_frm/thread/ee07da5e583c024a/8d72020ce3c9f7d7#8d72020ce3c9f7d7

Frederic Blanqui announced:
A one-year INRIA post-doctoral position is available: 

Title: Generation of construction functions guaranteeing algebraic invariants 
on concrete data types 

Aim: Although concrete data types are very useful in defining complex data 
structures, they are not always sufficient to adequately specify the data 
structures required by some algorithms. Often, only a subset of the concrete 
data type is in fact used since some invariants between the components are 
mandatory to ensure the correctness of the program. Now, many invariants can be 
described by using some equational theory. For instance, a sorted list is a 
particular representative of the equivalence class of lists modulo 
commutativity. The usual way to solve this problem is to use abstract data 
types or, better, private data types if one does not want to lose the ability 
of doing pattern matching. We propose to study the automatic generation of 
certified construction functions guaranteeing algebraic invariants on concrete 
data types, and develop an extension of OCaml with relational data types, that 
is, data types with invariants described by user defined equations. 

More information and online application on: 
http://www.talentsplace.com/syndication1/inria/frpostdoc/details.html?id=PGTFK026203F3VBQB6G68LONZ&LOV5=4508&LOV6=4514&LG=FR&Resultsperpage=20&nPostingID=1155&nPostingTargetID=3197&option=52&sort=DESC&nDepartmentID=19

Competences and profile: The position involves research and development in the 
area of functional programming, rewriting theory (in particular Knuth-Bendix 
completion) and, possibly, interactive theorem proving (experience with a proof 
assistant such as Coq is welcome). Speaking french is not necessary. 

Requirements: Candidates are required to hold a PhD degree between May 2006 and 
June 2007. 

Salary: the monthly gross salary is approx. EUR 2,150. 

Environment: 
- laboratory: LORIA (http://www.loria.fr/) 
- team: Protheo (http://protheo.loria.fr/) 
- project: Quotient (http://quotient.loria.fr/) 
- location: Nancy, in the East of France is at 1:30 from Paris by tren, 1:30 
from Luxembourg airport by car, and 1:30 from Germany and Belgium. 

Application deadline: 1st July 2007. 

Contact: Frederic Blanqui (http://www.loria.fr/~blanqui/) 

More information about INRIA post-doctoral positions: 
http://www.inria.fr/travailler/opportunites/postdoc/postdoc.en.html
			

wiki for libraries comparisons

Archive: http://groups.google.com/group/fa.caml/browse_frm/thread/05cf4c78c0372613/b53800420bff4407#b53800420bff4407

Jean-Baptiste Rouquier announced:
I just created http://cocan.org/comparisons (thanks to Christophe 
Raffalli for allowing me to reuse 
http://www.lama.univ-savoie.fr/~raffalli/ocaml-parsing.html) 
It seems to me that a wiki is more suitable than a mailing list for this 
kind of information sharing. 

Feel free to 
 - add you wishes on the list of needs to compare 
 - contribute to the pages (even small additions and corrections) 
 - argue that wikipedia would be better for this (and do the migration)
			

documentation for building C++ libraries with ocamlbuild

Archive: http://groups.google.com/group/fa.caml/browse_frm/thread/c626f0c7fc2a26ff/640c0d6c7eb641b5#640c0d6c7eb641b5

Christian Sternagel asked and Nicolas Pouillard answered:
> Is there some documentation or at least a tutorial for how to setup 
> ocamlbuild in order to build a lib<name>.a file from a bunch of *.c, *.C, 
> and *.h files? 

Roughly... 
$ cat libfoo.clib 
foo1.o 
bar2.o 
.. 

$ ocamlbuild libfoo.a 

> And after having done that, how to tell ocamlbuild that some ocmal-program 
> which is build depends on lib<name>.a. 

$ cat _tags 
<myocamprog.{byte,native}: use_foo 
$ cat myocamlbuild.ml 
open Ocamlbuild_plugin;; 
open Command;; 
dispatch begin function 
| After_rules -> 
    flag ["ocaml"; "link"; "use_foo"] 
            (S[A"-cc"; A"g++"; A"-ccopt"; A"-Lfoo"; A"-custom"; 
A"-cclib"; A"-Ifoo"]); 
    dep ["ocaml"; "link"; "use_foo") ["libfoo.a"] 
end;; 

Some `flag' declaration might be useful in order to tweak the C/C++ compilation.
			

[Camlp4 3.10] The rosetta stone

Archive: http://groups.google.com/group/fa.caml/browse_frm/thread/3e1b0e92a9c6b184/3d83e781758b5d29#3d83e781758b5d29

Martin Jambon asked and Nicolas Pouillard answered:
> I would like you or anyone knowledgeable to translate one significant 
> syntax extension. You know, some kind of Rosetta stone. You can take 
> Markus' sexp syntax extension or ioxml if you prefer, it won't be much 
> different. 


Here is your rosetta stone :) 
I translated pa_json_static.ml. 

To highlight a little the changes in the AST, 
I want to show an input snippet and two translations: 

For the old camlp4 it was: 

| Object l -> 
   let ml = List.map (fun x -> (x.field_caml_name, 
                                convert x.field_type)) l in 
   <:ctyp< < $list:ml$ > >> 

The type of `ml' is (string * ctyp) list. The concept of quotations is 
to get concrete syntax for abstract terms and then avoid to learn all 
constructors and types. Alas for some of them you have to know the type. 
In the new version you can express any term (except one) by concrete syntax. 

The closest version is: 

| Object l -> 
   let ml = List.map (fun x -> 
     <:ctyp< $lid:x.field_caml_name$ : $convert x.field_type$ >>) l in 
   <:ctyp< < $list:ml$ > >> 

Here one doesn't know if methods declarations are a pair or something else and 
we don't care. Since one knows the syntax << method_name : method_type >>. 
At this place the list antiquotation $list:ml$ is a sugar for 
$Ast.tySem_of_list ml$. 

By changing a little more the code one can use something closer to the 
object syntax. 

| Object l -> 
   let ml = List.fold_right (fun x acc -> 
     <:ctyp< $lid:x.field_caml_name$ : $convert x.field_type$ ; $acc$ >>) 
     l <:ctyp<>> in 
   <:ctyp< < $ml$ > >> 

The general syntax of object types (omiting `..' for the row variable) is 
< meth1 : type1 ; ... ; methN : typeN > then one can avoid to construct a list 
(since map is a fold_right with `::') and then call a function that destruct it. 

Another thing to point out is the use of the nil type <:ctyp<>> that is quite 
useful to start the folding. 

In this translation I used both styles depending of the context. 

The patch: 
  http://gallium.inria.fr/~pouillar/pub/camlp4/rosetta/pa_json_static/pa_json_static.patch

The new version (compiles with camlp4orf): 
  http://gallium.inria.fr/~pouillar/pub/camlp4/rosetta/pa_json_static/pa_json_static.ml
			

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}$'?'&lt;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 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