Re: Q: Caml for number crunching and/or scripting?

From: William Chesters (
Date: Sat Sep 13 1997 - 19:30:10 MET DST

Date: Sat, 13 Sep 1997 18:30:10 +0100
Message-Id: <6033.199709131730@venus>
From: William Chesters <>
Subject: Re: Q: Caml for number crunching and/or scripting?

Basile Starynkevitch writes:
> Hello All,
> Are there anyone using CAML or Ocaml
> for numerical/physical/scientific applications (maybe number crunching)
> as an embeddable scripting langage
> (both are possible: using CAML as a scripting langage driving low
> level -eg Fortran- numerical routines)

Yes, I use it for both actually.

I've used camlp4 (much recommended btw) to extend the syntax of ocaml
so that I can write matrix/tensor calculations using the summation

        tens v[I J] += w[I K J L] b[K L] + k a[I J]

and have a very efficient loop to do the work inserted automatically,
in C or in ML.

I keep the matrices in Fortran layout so that I can use Lapack
routines on them. Using ocamlopt's -output-obj option you can even
squeeze in a call initialise the f2c libraries at startup time.

I've also taken to using ocaml for scripting jobs that are more
complicated than Perl can comfortably handle. It's interesting that
ML's background as a very abstract language gives it some of the
conciseness and convenience of Perl, but without the flakiness.
On the other hand I'd rather have Perl's than emacs's regexps ...

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:12 MET