Previous week Up Next week

Hello

Here is the latest Caml Weekly News, for the week of 21 to 28 October, 2003.

  1. Question about linking C++ and OCAML
  2. ocamlgsl release
  3. Enhanced Ocaml Documentation Version 3.07
  4. IBM funding for OCaml on Eclipse?
  5. perl4caml 0.3.6 and mod_caml 1.0.0
  6. partial eval question
  7. Ocamlodbc

Question about linking C++ and OCAML

Dan Koppel asked and Kamil Shakirov answered:
> I'm new to OCAML.  I have written C++ code which needs to call a
> OCAML subroutine (written by somebody else).  I'm using a Windows
> XP/Pentium 4 system and have the Microsoft Visual C++ compiler.  I
> was wondering if anybody has experience doing this and could kindly
> give me some instructions on how to accomplish this.

You may use the ODLL tool from the http://tech.motion-twin.com/

``ODLL is creating a Win32 DLL from an OCaml library, and
automatically generating the C stubs needed to interface the OCaml
code and the C code and the .H interface. Simply run ODLL with you
CMA/CMXA and one or several CMI interfaces and ODLL will do the job
for you.''

I hope it helps you.
    

ocamlgsl release

Olivier Andrieu announced:
This is to announce the release of ocamlgsl version 0.3.0 .

ocamlgsl is a set of bindings for GSL, the GNU Scientific Library
http://sources.redhat.com/gsl/ . GSL is "a collection of routines for
numerical computing" : this includes RNGs, special functions, FFT,
linear algebra, numerical integration, etc.

What's new:
 - support for the latest GSL (version 1.4)
 - bugfixes
 - compiles with MSVC (contributed by Lexifi)

available here :
http://oandrieu.nerim.net/ocaml/gsl/
    

Enhanced Ocaml Documentation Version 3.07

Hendrik Tews announced:
I would like to announce the

                 The Enhanced Ocaml Documentation
                          Version 3.07
   available via http://wwwtcs.inf.tu-dresden.de/~tews/htmlman-3.07


The enhanced documentation contains the original html version of
the ocaml reference manual with the following changes:

- Changes (wrt version 3.06) are tagged with icons and color

- meta symbols of the grammar are "hot" and refer to their
  definition.

- additional appendix containing just the grammar rules


Browsing through the Enhanced Ocaml Documentation you will
discover the following changes that have not been announced in
http://caml.inria.fr/archives/200309/msg00313.html :

- character literals can be given hexadecimal line '\x40'
- matching or-patterns is now guaranteed left-to-right
- OCAMLRUNPARAM can be given in hexadicimal
- new ocamllex argument -ml (use an ocaml engine) and -o (output file)
- parametrized ocamllex lexers
- in ocamllex one can choose between "shortest match" and "longest match" rule
- 4 new options for ocamldoc/texinfo: -info-entry, -info-section,
  -noheader, and -notrailer
- new function Buffer.add_substitute
- new printf conversion %! (flush)
    

IBM funding for OCaml on Eclipse?

Greg K said:
Anyone want to do something with OCaml on Eclipse?

IBM has a million dollars in grants for teaching and research efforts done
with their extensible open source IDE. (I currently use it for Java work -
its very good, reminds me of Smalltalk dev environments.) It's designed to
be extensible to support other languages (currently has a strong working
C++ extension, and many other languages coming along).

Any OCaml proposals should probably include some work to allow Java and
OCaml runtimes to inter-operate.

Proposals are due by November 7th.

http://www-3.ibm.com/software/info/university/products/eclipse/eig.html
    

perl4caml 0.3.6 and mod_caml 1.0.0

Richard Jones announced:
I'm pleased to announce two new free software products from Merjis Ltd.:

 * perl4caml 0.3.6  - use Perl code and libraries within Objective CAML   
 * mod_caml 1.0.0   - OCaml bindings for the Apache API (and much more!)  

(I'm combining these two announcements into one to reduce list bandwidth)

More information about perl4caml here:

        http://www.merjis.com/developers/perl4caml/

More information about mod_caml is available here:

        http://savannah.nongnu.org/files/?group=modcaml
        http://www.merjis.com/developers/mod_caml/

In addition, if you install both perl4caml and mod_caml at the same
time, then you can use any Perl DBD (database driver) with the
mod_caml DBI database layer. Perl DBDs are available for a wide
variety of databases.
    

partial eval question

Ben Kavanagh asked and Damien Pous answered:
> Say I have a function such as pow defined as
>
> let pow n x =
>     let rec pow_iter (n1, x1, p1) =
>         if (n1 = 0) then p1
>         else if (n1 mod 2 = 0)
>                then pow_iter(n1/2, x1*x1, p1)
>              else pow_iter(n1-1, x1, p1*x1)
>     in pow_iter(n, x, 1);;
>
> and I say
>
> let pow2 = pow 2
>
> Are there any ML implementations that would automatically perform
> partial evaluation to create pow2 instead of using closures, possibly
> unfolding the pow_iter call? Would Caml ever have this capability?

Multi-Stage Programming is your friend...
http://www.cs.rice.edu/~taha/MSP/

There are two ML implementations :
Ocaml : MetaOCaml http://www.cs.rice.edu/~taha/MetaOCaml/
SML : MetaML http://www.cse.ogi.edu/PacSoft/projects/metaml/


let rec pow n = .<
        .~(match n with
                | 1 -> .< fun x -> x >.
                | n -> .< fun x -> x * .~(pow (n-1)) x>.
        )
>.

(pow 3) get reduced into .<fun x -> x*x*x>.
    
Dmitry Lomov added:
May I also humbly draw your attention to Dynamic Caml:
http://oops.tercom.ru/dml

:)
    

Ocamlodbc

Alex Baretta asked and Erik Arneson answered:
> I'm working on interfacing a piece of Ocaml code with an Oracle
> dbms. I noticed that Ocamlodbc does support Oracle, and I've been able
> to build both the unixodbc and the ocamlodbc/oraclecfo libraries. I'd
> like to know what C client libraries/ODBC drivers i need for Oracle to
> work with ocamlodbc.

You will need the Oracle client installation and an ODBC driver.  As
far as I know there are no stable freely-available Oracle ODBC drivers
for UnixODBC, but there are a few commercial drivers that look pretty
nice.

> Also, does anyone know if there is a "native" client library for
> Oracle à la libpq de PostgreSQL?   

Search the Caml Humps for the OCaml OCI library.  There is one out
there.  I have used it with success.  Here's the URL:

                   http://oci8ml.sourceforge.net/

Good luck!
    
Sebastien Ferre added:
I recently implemented an access to Oracle for OCaml.
I just use the free C library libsqlora8, which provides
an easy interface to Oracle, and wrap it in a OCaml module.
The interface is simple, and probably limited, but I think
it is suitable to most uses.

The C library is available at http://www.poitschke.de/libsqlora8/ .
I can give you the wrapping code (a C file + a ML file), if you wish.
    

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