Previous week Up Next week

Hello

Here is the latest Caml Weekly News, for the week of June 26 to July 03, 2012.

  1. Camllexer v1.1.1
  2. Quant position at LexiFi
  3. oasis v0.3.0: Architecture for building OCaml libraries and applications
  4. howto: recursively iterate over filesystem
  5. Other Caml News

Camllexer v1.1.1

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-06/msg00191.html

Wojciech Meyer announced:
On behalf of Nicolas Pouillard, I'm happy that now Camllexer is
available as an Oasis package from [1]. The development version can be
found here [2]. The odb package manager shall be updated soon.

[1] http://oasis.ocamlcore.org/dev/view/camllexer/1.1.1

As read in the distribution's README file:

"
Camllexer is an enhanced lexer for Caml dialects.

The lexer has been extracted from the Camlp4 (> 3.10) lexer, which in
turns was reimplemented as a derivative of the lexer from the OCaml
compiler.

This lexer has the following particularities:

* Correct and complete: as far as testing gone (~800_000 distinct
lines over ~3_000_000 lines of Caml like files).
* Supports most Caml dialects:
o By re-using the lexer of Camlp4 this lexer works on any
extension of the OCaml language made with Camlp4. In
particular it has a support for quotations and
anti-quotations.
o Works fine on lexers and parsers (ocamllex, ocamlyacc),
except when using the C style of comments.
* Lossless: every single bit of the input file is kept. Blanks,
comments, newlines, lexical conventions for writing literals, all
of it is kept in the returned token stream. Undesired information
can easily be thrown out of the stream.
* Keyword independent: there is no token for keywords. This is up to
you to cast some LIDENTs and some SYMBOLs into proper keyword
tokens of your own token type.
* Fault tolerant: errors take part of the token stream, allowing to
write fault tolerant translations.
* Flexible warnings: the lexer warn about some corner case of the
lexical conventions that the user might want to avoid, again
warnings take part of the token stream such that you easily
control everything.
* A simple lexer program is provided, it enables quick debugging,
and simple stream editions using Unix pipelines!
"
      

Quant position at LexiFi

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-06/msg00192.html

Alain Frisch announced:
LexiFi is looking to expand its team of quantitative engineers,
working on pricing algorithms for financial products and related
stuff. This position includes a part of programming, in OCaml of
course, so this might be of interest for those in this community with
a background or an interest in numerical methods and finance.

More details on the job opening: http://bit.ly/OQ8ZgC
On LexiFi: http://www.lexifi.com
      

oasis v0.3.0: Architecture for building OCaml libraries and applications

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-06/msg00193.html

Sylvain Le Gall announced:
A lot of changes, for this new release. 

Most important:

Fix bug with scanf %S@\n for ocaml 4.00. We were unfortunetaly using an
undocumented tolerance of Scanf in the previous version. You should
consider making new release using this version that fixed this. 

PACKAGES uploaded to oasis-db will be automatically "derived" before
OCaml 4.00 release (i.e. oUnit v1.1.1 will be regenerated with this new
version as oUnit v1.1.1~oasis1).

PACKAGES not uploaded to oasis-db need to be regenerated. In order not to 
break 3rd party tools that consider a tarball constant, I recommend to 
create a new version.

Thanks to INRIA OCaml team for synchronizing with us on this point.

Full article about this new release here:
http://le-gall.net/sylvain+violaine/blog/index.php?post/2012/06/28/OASIS-0.3.0-release

Download it here:
http://forge.ocamlcore.org/frs/download.php/918/oasis-0.3.0.tar.gz

The project:

OASIS generates a full configure, build and install system for your
application. It starts with a simple `_oasis` file at the toplevel of your
project and creates everything required.

It uses external tools like OCamlbuild and it can be considered as the glue
between various subsystems that do the job. It should support the following
tools:

- OCamlbuild
- OMake (todo)
- OCamlMakefile (todo),
- ocaml-autoconf (todo)

It also features a do-it-yourself command line invocation and an internal
configure/install scheme. Libraries are managed through findlib. It has been
tested on GNU Linux and Windows.

It also allows to have standard entry points and description. It helps to
integrates your libraries and software with third parties tools like GODI.

Homepage:
http://oasis.forge.ocamlcore.org/

Get source code:
$ darcs get http://darcs.ocamlcore.org/repos/oasis

Browse source code:
http://darcs.ocamlcore.org/cgi-bin/darcsweb.cgi?r=oasis;a=summary
      
Daniel Bünzli asked and Wojciech Meyer replied:
> Tried to remove the flag manually in 
> `~/.odb/install-type_conv/type_conv-108.00.01/myocamlbuild.ml` but it seems 
> that when I reissue `odb --unstable type_conv`, odb restarts everything 
> from scratch, download included.

You can simply reissue:

ocaml setup.ml -build
ocaml setup.ml -install

in ~/.odb/install-type_conv/type_conv-108.00.01/

that should work.

> There is `--get` that only downloads and extracts the package is there a 
> flag like `--no-get` to be able to start from that state in odb ?

at the moment I can't look into that, but I hardly can remember if
that was possible.
      
Edgar Friendly also replied:
At the moment, the way to have odb.ml install a package from a local
directory is to add it to your packages file, like this:

type_conv dir=~/.odb/install-type_conv/type_conv-108.00.01

At the moment, odb allows the use of tarballs (http or local) on the
command line, but doesn't properly handle local directories. I'll see
if I can add support for this quickly.
      

howto: recursively iterate over filesystem

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-07/msg00015.html

Ivan asked:
Are there any libraries that allow to walk through a filesystem (linux
filesystem in particular). At best I would like to find some library
that provides an ``iter'' function that will recursively iterate over
files and subdir in the given folder. At the very best, a library
resembling (by functionality) boost.filesystem will be very nice.
      
Rudi Grinberg suggeste:
Take a look here http://pleac.sourceforge.net/pleac_ocaml/directories.html
under the heading: "Processing All Files in a Directory Recursively"
      
Stéphane Glondu also suggested:
http://forge.ocamlcore.org/projects/ocaml-fileutils/
      
Fabrice Le Fessant also suggested:
let rec iter_dir f dirname =
  let files = Sys.readdir dirname in
  Array.iter (fun file ->
     let file = Filename.concat dirname file in
     (f file : unit);
     if Sys.is_directory file then iter_dir f file
 ) files
      
Daniel Bünzli also suggested:
The book on Unix system programming in OCaml shows how to write a
`find` function.

   http://ocamlunix.forge.ocamlcore.org/files.html#htoc11

But if you don't need tight control over the process and don't want to
link against the Unix module, just roll your own with the functions in
Sys.

That's what I usually use (note that it does follow symlinks). 

   val fold_files_rec : string list -> ('a -> string -> 'a) -> 'a -> 'a
   (** [fold_files_rec dirs f acc] lists the files in [dirs], recursively
        in depth first order and folds the function [f] over the file names. *)

   let fold_files_rec dirs f acc = 
     let readdir d = try Array.to_list (Sys.readdir d) with Sys_error _ -> [] in
     let is_dir d = try Sys.is_directory d with Sys_error _ -> false in
     let rec loop f acc = function
     | (d :: ds) :: up -> 
        let files = List.rev (List.rev_map (Filename.concat d) (readdir d)) in
        let dirs, files = List.partition is_dir files in
        let acc = List.fold_left f acc files in 
        loop f acc (dirs :: ds :: up)
     | [] :: [] -> acc
     | [] :: up -> loop f acc up
     | _ -> assert false
     in
     loop f acc (dirs :: []) 
      

Other Caml News

From the ocamlcore planet blog:
Thanks to Alp Mestan, we now include in the Caml Weekly News the links to the
recent posts from the ocamlcore planet blog at http://planet.ocamlcore.org/.

Assessing Abstractions:
  http://alaska-kamtchatka.blogspot.com/2012/07/assessing-abstractions.html

Oasis 0.3:
  http://caml.inria.fr/cgi-bin/hump.cgi?contrib=726

Camllexer 1.1:
  http://caml.inria.fr/cgi-bin/hump.cgi?contrib=819

The story of a stack overflow during Coq extraction:
  http://gallium.inria.fr/~scherer/gagallium/stack-overflow-during-coq-extraction/index.html

google-drive-ocamlfuse:
  https://forge.ocamlcore.org/projects/gdfuse/

2D Interpolation, Part 5: Final Optimizations:
  http://alaska-kamtchatka.blogspot.com/2012/06/2d-interpolation-part-5-final.html

Managing and Analyzing Big-Data in Genomics:
  http://ashishagarwal.org/2012/06/29/ibm-pl-day/?utm_source=rss&utm_medium=rss&utm_campaign=ibm-pl-day

Syntax extensions without Camlp4: let's do it!:
  http://www.lexifi.com/blog/syntax-extensions-without-camlp4-lets-do-it

OASIS v0.3.0 release:
  https://forge.ocamlcore.org/forum/forum.php?forum_id=843

Opa: Post 1.0 Status Update:
  http://blog.opalang.org/2012/06/opa-post-10-status-update.html
      

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