Previous week Up Next week

Hello

Here is the latest Caml Weekly News, for the week of 01 to 08 February, 2005.

  1. cyclic types
  2. mod_caml & COCANWIKI mailing list and discussion area
  3. Estimating the size of the ocaml community
  4. OCaml-related job announcement
  5. OCaml syntax colorer for Scintilla/SciTE
  6. OCaml && COCOA-Environment (Mac-OS-X/GUI)
  7. New Ocaml indentation for Vim
  8. Dumper 0.9.1

cyclic types

Archive: http://caml.inria.fr/archives/200502/msg00006.html

Continuing the thread, Christophe Raffalli said:
>       let f x = x :: x
> 
> where the author of that code really intended
> 
>       let f x = x @ x
> 
> With -rectypes, the wrong definition (with ::) is accepted with type
> 
> val f : ('a list as 'a) -> 'a list = <fun>
> 
> and it's only when you try to apply f to a "normal" list that the
> problem arises, with a hard-to-understand error message:
> 
> f [1;2;3];;
>    ^
> This expression has type int but is here used with type 'a list as 'a
> 

Why do you think 'a list as 'a is an <<"impossible" recursive types>> ?
It is a very nice representation of ordinals up to epsilon_0 (curious, 
see the code below)

Why not this restriction: accept a recursive type 't as 'a only if
access to 'a in t needs to expand a definition. I mean, the cyclicity 
check at the end of unification could check that one traverses 
definition. I am not sure how OCaml treat type annotation, this will 
work only if the compiler does its best to use all type annotation.

'a list as 'a is illegal

and let f x = x @ x is illegal

type ord = ord list is legal (all type definition should be legal)

let f (x:ord) = x @ x is legal

code for curious:
--------------------------8<----------------
(* need -rectypes *)

(*
   a very short representation of ordinals up to epsilon_0 as a fixpoint 
of list
*)
type ord = ord list


(* comparison: you must normalize ordinal before comparison *)
let rec compare  (o1:ord) (o2:ord) = match o1, o2 with
   | [], [] -> 0
   | [], _ -> -1
   | _, [] -> 1
   | x::o1', y::o2' ->
       match compare x y with
	-1 -> compare o1' o2
       | 1 -> compare o1 o2'
       | 0 -> compare o1' o2'

let lesseq o1 o2 = compare o1 o2 <= 0

(* compute the normal form of an ordinal*)
let rec normalize (o1:ord) =
   List.sort (fun x y -> compare y x) (List.map normalize o1)

let zero = ([] : ord)
let un = ([[]] : ord)
let deux = ([[];[]] : ord)
let omega = ([[[]]] : ord)
let deux_omega = ([[[]];[[]]] : ord)
let omega_square = ([[[];[]]] : ord)
let omega_to_the_omega = ([[[[]]]] : ord)

let addition (o1:ord) (o2:ord) = o1 @ o2

let rec multiplication (o1:ord) (o2:ord) = match o1, o2 with
   [], _ -> [] (* zero * o2 = zero *)
| _, [] -> [] (* o1 * zero = zero *)
| ([]::o1'), _ -> (* (1 + o1') * o2 = o2 + o1' * o2 *)
   addition o2 (multiplication o1' o2)
| _, ([]::o2') -> (* o1 * (1 + o2') = o1 + o1 * o2' *)
   addition o1 (multiplication o1 o2')
| (o1''::o1'),(o2''::o2') ->
     (* (w^o1'' + o1')*(w^o2'' + o2') = w^(o1''+o2'') + o2'*w^o1'' +
             o1'*w^o2'' + o1'*o2' *)
     (addition o1'' o2'')::(multiplication [o1''] o2')@
     (multiplication o1' [o2''])@(multiplication o1' o2')

(* test *)
let _ = compare [[]] [[];[]]
let _ = compare [[[]];[]] [[];[[]]]
let _ = compare [[[]]] [[];[[]]]
let _ = compare omega_to_the_omega omega_square
let _ = normalize [[];[[]]]
let _ = normalize [[[];[]];[];[[]]]
let quatre = multiplication deux deux
let quatre_omega = multiplication omega quatre
let big = normalize (multiplication omega_to_the_omega quatre_omega)
    

mod_caml & COCANWIKI mailing list and discussion area

Archive: http://caml.inria.fr/archives/200502/msg00027.html

Richard Jones announced:
We have a new mailing list for mod_caml and COCANWIKI questions.  More
details here: http://sandbox.merjis.com/mailing_list .

There is also a general online discussion area for mod_caml and
COCANWIKI questions here: http://sandbox.merjis.com/discussion .
    

Estimating the size of the ocaml community

Archive: http://caml.inria.fr/archives/200502/msg00021.html

Note from the editor:
The following messages are part of a huge thread that developped last week.
    
Yaron Minsky said:
I've been trying to come up with some estimates on the size of the ocaml
community, and I'm wondering if others have come up with anything better.
Here's what I have so far:

- The mailing list is supposed to have about 500 subscribers[1].  Hard to know
  if this number is up-to-date.  I wonder if that number has changed over
  time, and what it is today.

- The OCaml Humps contributors page[2] has about 200 members.

- If you type OCaml into google, you get about 800k hits.  This compares with
  29 million for C++.  "python programming" (without the quotes) gets about 5
  million

- If you type "ocaml resume", you get about 5.5k hits.  If you type "python
  resume", you get about 270k hits.  If you type "C++ resume", you get almost
  1m hits.

- Some schools teach ocaml.  Brown and Caltech apparently have intro ocaml
  courses.  Any other places that teach the language?  Any ideas on how many
  students go through these courses?

- A few companies use ocaml, including Baretta DE&IT, Dassault Aviation,
  LexiFi, Artisan (which has been bought up by AMD?)  Anyone know of other
  such companies?  It would be interesting to get a list togther of companies
  that use ocaml significantly.

I'd be interested of any evidence people have of the size and vibrancy of the
ocaml community.  I'd be particularly interested in evidence of ocaml use in
the United States, since it seems like a majority of ocaml use is outside of
the US.

[1] http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
[2] http://caml.inria.fr/humps/index_contributors.html
    
Christopher A. Watford said:
The University of Illinois at Urbana-Champaign uses OCaml to teach
programming language theory classes. This is where I was introduced to
OCaml for the first time. Basically we built parsers, lexers, and type
checkers. Function programming was included in the coursework, but
mainly to show its strong suits. Haskell is also taught in these
classes.
    
Kenneth Knowles said:
Here at UC Santa Cruz, my graduate programming language theory course used
O'Caml, though programming was a very small portion of the course content.  The
undergraduates are taught in C and Java, I think.
    
Michael Jeffrey Tucker said:
Although there are no courses that I know of at Harvard which set out to
teach OCaml, it has made appearances in a few classes that I have taken.
Specifically, a graduate-level Artificial Intelligence course on
Computational Game Theory that is offered periodically asks its students
to complete its problem sets using OCaml. Also, Prof.  Norman Ramsey's
course on Programming Languages last year included a lecture on "Classes
and Modules in Objective Caml", though I don't think that the students
were asked to write any code in OCaml for that course.
    
Richard Jones said:
The COCAN (Ocaml Alliance Network) at:

http://wiki.cocan.org/

has had between 60 and 120 unique visitors per week since it was
launched, (mid 2004).  There are more detailed stats here:

http://www.merjis.com/rocketstats/wiki.cocan.org/

Rich.

PS. We are still offering to do something for free with ocaml.org,
caml.inria.fr, involving a wiki which can be updated, but with
mailback so that people in charge can monitor changes.
    
Nicolas Cannasse said:
As Richard answered, the OCaml Alliance website at http://wiki.cocan.org is
a good place for all people in the industry to reference themselves and
learn about each other. Any people who is using ocaml quite intensively is
welcome to register on the website.
    
Evan Martin said:
The grad-level programming languages class at the University of
Washington used O'Caml throughout.
    
Eric Stokes said:
The two places I work both use Ocaml

California State University Northridge
Most of our middleware infrastructure is written in Ocaml (except the
directory server; for now), this includes both web pages using Wdialog,
and traditional middleware layers such as messaging and identity
management, to more low level things such as libraries implementing the
LDAP wire protocol. Remote middleware daemon is a project we started to
solve some of the problems of using ldap directly for identity
management, and ocamldap is a pretty nice ldap library.

http://ocamldap.sourceforge.net
http://www.csun.edu/~eric/ncc-website/opensource/rmwd/rmwd-description.html

Symas Inc.
We use Wdialog for our portal web site
    
Chris Danx said:
It is also used it TPL by Pierce and possibly the new advanced follow up 
book.  We use this book as a reference text on our Type Theory course at 
uni, but use Java and SableCC for our assignments.
    
Sylvain Le Gall said:
I know that a lot of course of Ecole Polytechnique ( X ) in IT use OCaml
as a support ( maybe it comes from the fact that some OCaml developper are
teaching here : Didier Remy, Luc Maranget... ). I learn OCaml there, and
i still use it on a daily basis / but not at work.
    
Don Syme said:
Microsoft has used OCaml for SLAM (http://research.microsoft.com/slam/)
and other amazing tools that find really deep bugs in the C code
implementing device drivers. Byron Cook spoke about this at INRIA
recently.  So when Windows doesn't crash when you pull your PCMCIA card
out at the very moment your machine goes into "hibernate" mode (roughly
speaking one of the bugs they found, though I've probably got the
details wrong) then remember that OCaml made a big contribution to that
:-)
    
John Skaller said:
AFAIK Barry Jay teaches Ocaml for FP at University of 
Technology, Sydney (in Oz).

The text book isn't Ocaml though .. I mean there isn't
one in English other than the online translation of
the French O'Reilly one.

I also had two Ocaml jobs in Australia, one with
Barry at UTS, where I learned it, and an industrial
one where I specified it myself, and then used it
(the company was a telco, the use was for a language
translator for telco service logic, which has
inspired my open source language Felix)

Two jobs in a row being paid to write Ocaml by
an employer is not bad.. I wish I could get
another one :)
    
Frédéric Gava said and Stefano Zacchiroli replied:
> I also heard that Ocaml is sometime teach in Italian Universities but I am
> not sure.

Yes, at least here at the Computer Science Department of the University
of Bologna it was teached in the past and used for students projects in
the compiler course, but this is no longer the case.  Still, it is used
as a programming language in some research projects.

I'm aware of the university of Urbino, in which OCaml is teached as a
part of the compiler course.
    
Jeff Shaw said:
Here at michigan state university, my computational linguistics professor 
had us learn ocaml for the class and we used it exclusively. I like it so 
much better than c++!
    
Vincenzo Ciancia said:
In Pisa it's used as metalanguage in the programming languages course.
    
Sven Luther said:
I don't know if it is interesting for what you need, but the debian popularity
contest :

  http://popcon.debian.org/

shows ocaml starting at position 1858 :

  #rank name                            inst  vote   old recent no-files (maintainer)
  1858  ocaml-base-nox                   743   238   396   109     0 (Sven Luther)                   

But this may be biased by the split of ocaml between different packages,
ocaml-base-nox is the runtime without X related libraries. The most used
packages (adduser for the per inst sorting) is around 6000, so this would mean
that about 10% install ocaml stuff, since inst is : 

  #<inst> is the number of people who installed this package;

Naturally, the results are probably biased by the way popularity contest is
run. popularity contest (popcon) is a package which you can install but which
is not installed by default, and where you can opt-in into the mechanism,
which sends (weekly ?) emails about the installed packages to the debian
popularity-contest. Still, this means that at least 743 people have it
installed, that 238 "use this package regularly", and 109 have recently
upgraded it. No idea about how the "use this package regularly" numbers are
calculated though.
    

OCaml-related job announcement

Archive: http://caml.inria.fr/archives/200502/msg00057.html

Yaron Minsky announced:
Jane Street Capital (an affiliate of Henry Capital
http://henrycapital.com) is a proprietary trading company located in
Manhattan. The quantitative research department is responsible for
analyzing, improving, and generating trading strategies.  It's an open
and informal environment (you can wear shorts and a t-shirt to the
office), and the work is technically challenging, including systems
work, machine learning, statistical analysis, parallel processing, and
anything that crosses our path that looks useful.

One unusual attraction of the job is that the large majority of our
programming is done in OCaml.  Pay is competitive, and we're a
reasonably small company (around 85 employees), so advancement is
pretty quick for someone who performs well.

Here's what we're looking for:

 - Top-notch mathematical and analytic skills.  We want people who
   can solve difficult technical problems, and think clearly and
   mathematically about all sorts of problems.

 - Strong programming skills.  Pretty much all of our programming is
   in OCaml, so being a solid caml hacker is a big plus.  But we're
   also interested in great programmers who we are convinced will be
   able to pick up OCaml quickly, so anyone with a high-level of
   proficiency with functional languages could be a good match.

 - Strong Unix/Linux skills --- We're looking for someone who knows
   their way around the standard unix tools, can write makefiles,
   shell scripts, etc.  We use a beowulf cluster for compute-intensive
   jobs, so experience programming for and administering clusters is a
   big plus.

If you're interested (or have any students you think might be a good
match) and would be willing to relocate to New York, please send a
cover-letter and resume to:

  yminsky@janestcapital.com
    

OCaml syntax colorer for Scintilla/SciTE

Archive: http://caml.inria.fr/archives/200502/msg00137.html

Robert Roessler announced:
A syntax colorer for the multi-platform (Win32 and GTK+/Linux) 
Scintilla editing component and SciTE text editor is available at 
http://www.rftp.com/Downloads.shtml .

Source, SciTE properties file and Windows DLL are included (not to 
mention installation instructions).  As the "caml.properties" file is 
easily edited, and especially because this is an *initial* release, 
feedback on anything besides my choice of colors is welcome! :)

Note that it does properly handle nested OCaml comments (but not 
mis-matched comment delimiters in strings in comments...), but does 
not currently implement the Scintilla "folding" operation - between 
the syntactic richness/complexity of OCaml itself and the variety of 
coding styles, it was not immediately obvious if any folding strategy 
would please anybody!  Again, comments *are* solicited.

The license is the same as Scintilla and SciTE - free usage for any 
type of project - see the included License.txt from the Scintilla and 
SciTE sites for details.
    

OCaml && COCOA-Environment (Mac-OS-X/GUI)

Archive: http://caml.inria.fr/archives/200502/msg00143.html

Oliver Bandel asked and Julien Roussel answered:
> is there a COCOA-Binding/Lib for OCaml?
> 
> I want to do GUI-stuff for data-input by users
> as well as 3D-graphics (OpenGL-like) on Mac-OS-X.
> And I would be sooooo happy, it can be made with
> OCaml.
> Not that Objective-C or is a bad thing.... but
> doing the whole stuff in OCaml is preferred.
> 
> Is there a library to use Ocaml with Mac-OS-X' GUIs?

There is a COCOA-CAML binding developed by Jean-Baptiste Poix, an
alpha version is available at
http://labo.epimac.org/article.php3?id_article=7 .

Sorry but the page is still in french, an english version and a
documentation will be available soon. You can download an example at
http://labo.epimac.org/IMG/gz/first_cococaml.tar.gz .

Please do not hesitate to contact Jean-Baptiste (tipoix@free.fr) with
any questions.
    
Mike Hamburg added:
Additionally, I developed a very rudimentary binding.  It allowed the 
user to call Cocoa methods from O'Caml, but it had an enormous 
overhead: each method invocation from O'Caml had the overhead of about 
5 method calls from the C glue.  There was a (somewhat more efficient) 
Cocoa-to-O'Caml call method, but I don't remember if I ever finished 
it.

Paul Snively, Nick Burlett and I were working on a more efficient 
bridge, by means of parsing Cocoa headers to automatically generate 
typed bindings which would look like objects to O'Caml, but the project 
fizzled without any real results.  Perhaps someone with more FrontC 
knowledge could resurrect it.  The existing code is not strongly typed: 
you can attempt to pass the wrong number or type of arguments to a 
method, and it will raise an O'Caml exception instead of rejecting it 
at compile time.

The O'Caml-to-Cocoa bridge is not online, but I can send you what code 
we have if you want.
    

New Ocaml indentation for Vim

Archive: http://caml.inria.fr/archives/200502/msg00171.html

David Baelde announced:
I'm developping a new Caml indentation for Vim, which looks like tuareg 
a lot, plus performs nice things like folding. I believe it's already 
good enough for being used, but I'm looking for testers, for bug finding 
but also discussing some points where I don't follow tuareg.

The main scripts are at:
http://www.vim.org/scripts/script.php?script_id=1196
and you may wish to take a look at an alpha-version of a code annotation 
lookup utility at:
http://www.vim.org/scripts/script.php?script_id=1197
    

Dumper 0.9.1

Archive: http://caml.inria.fr/archives/200502/msg00183.html

Richard Jones announced:
We're pleased to announce the release of a Dumper module for OCaml,
version 0.9.1.  Dumper is a tiny OCaml library for dumping out data
structures.  This is very useful when debugging.  It's roughly the
OCaml equivalent of Perl's Data::Dumper.

The license is LGPL + OCaml linking exception.  It's pure OCaml and
doesn't have any dependencies outside the base library.

http://merjis.com/developers/dumper
    

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