Hello
Here is the latest Caml Weekly News, for the week of March 28 to April 04, 2006.
Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/32646/focus=32646
Hendrik Tews asked and Michael Wohlwend answered:
> is the following really the intented behaviour?
>
> # Scanf.sscanf " a" " %n" (fun n -> n);;
> - : int = 2
> # Scanf.sscanf " a" " a%n" (fun n -> n);;
> - : int = 2
>
> In the first one only one character is consumed, it should IMO
> return 1. The second one consumes one character more than the
> first one. So it should return one more than the first one.
>
> How can I scan _precisely_ one space without the look ahead
> behavior that the format " " apparently has? I guessed "% ", but
> that raises an exception.
sscanf " a" "%1[ ]%n" (fun s n -> n);;
scans only one space...
Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/32648/focus=32648
Jonathan Bryant asked and Jean-Christophe Filliatre answered:
> Has anybody ever come up with a way of doing these things (HOFs,
> functors, partial application, module types, parametric polymorphism) in
> UML or any kind of modeling language?
In Norman Ramsey's nice paper "ML Module Mania" you'll find such a
diagram for a complex combination of signatures, modules and functors:
see
http://www.eecs.harvard.edu/nr/pubs/maniaws-abstract.html
There are similar diagrams in Philippe Narbel's recent book about
Ocaml, but unfortunately this book is only printed in French (if I'm
right).
Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/32655/focus=32655
Damien Doligez announced:
We have created a "release candidate" version OCaml 3.09.2+rc1. This
will
become release 3.09.2 on April 12 (approximately), unless there is some
serious problem with it.
In the meantime, we are asking for some beta-testing: if you are an
adventurous mind with some free time, check it out from the CVS (tag:
ocaml3092rc1) and compile your favourite programs with it, and report
any problems you might find.
Note that we are deliberately _not_ making it available as a tar archive
or binary package.
This is the list of changes from 3.09.1. We would especially like some
feedback (positive or negative) about the items marked with "+". If
you find some problem, please post it to the bug tracker:
http://caml.inria.fr/mantis/main_page.php. If everything goes well,
send a mail to the release manager: damien.doligez@inria.fr .
Bug fixes:
- Makefile: problem with "make world.opt" PR#3954
- compilers: problem compiling several modules with one command line
PR#3979
- compilers,ocamldoc: error message that Emacs cannot parse
- compilers: crash when printing type error PR#3968
- compilers: -dtypes wrong for monomorphic type variables PR#3894
- compilers: wrong warning on optional arguments PR#3980
- compilers: crash when wrong use of type constructor in let rec PR#3976
- compilers: better wording of "statement never returns" warning PR#3889
+ runtime: inefficiency of signal handling PR#3990
+ runtime: crashes with I/O in multithread programs PR#3906
- camlp4: empty file name in error messages PR#3886
- camlp4: stack overflow PR#3948
- otherlibs/labltk: ocamlbrowser ignores its command line options
PR#3961
- otherlibs/unix: Unix.times wrong under Mac OS X PR#3960
- otherlibs/unix: wrong doc for execvp and execvpe PR#3973
+ stdlib: update_mod not found under Windows PR#3847
- stdlib: Filename.dirname/basename wrong on Win32 PR#3933
- stdlib: incomplete documentation of Pervasives.abs PR#3967
- stdlib: Printf bugs PR#3902, PR#3955
- tools/checkstack.c missing include
- yacc: crash when given argument "-" PR#3956
New features:
+ ported to MacOS X on Intel PR#3985
+ configure: added support for GNU Hurd PR#3991
-- the OCaml team
Markus Mottl then said:
> + runtime: inefficiency of signal handling PR#3990
The extreme slowdown observed between 3.08.4 and 3.09.1 seems to be
fixed now. The example "slow.ml" in the bugtracker now runs approx.
two times slower without thread support with the CVS-release in
comparison to 3.08.4 (due to now correct signal handling), and I don't
see any mentionable slowdown anymore if thread support is compiled in.
The version compiled with thread support is about 30 times slower than
the one compiled without, but there is does not seem to be any way
around this considering the need for locking mutexes, signaling
condition variables, etc.
> + runtime: crashes with I/O in multithread programs PR#3906
I'm very happy to report that I haven't seen any instance of this
nasty problem in the effected application since the patch was
available in CVS, and we would quite likely have seen it already, as
it has been under fairly heavy load since then (for about a week).
All of the above has been tried with OCaml 3.09.2+dev6 (2006-03-22),
and I have proofread both patches, because we run our production
systems with them. There are only a few additional patches in RC1,
which we will skip until the final release, so we do not expect any
unwanted surprises.
I haven't investigated any of the other fixes that have already made
it into the CVS-release we are running, but we haven't seen any
problems so far.
Thanks for all the hard work making OCaml even better!
Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/32653/focus=32653
Jonathan Roewen asked and Martin Jambon answered:
> I'm having a small problem trying to tidily define an equivalent
> function to some Haskell code.
>
> Haskell:
> pThen combine p1 p2 toks
> = [ (combine v1 v2, toks2) | (v1,toks1) <- p1 toks, (v2, toks2) <- p2 toks1 ]
>
> (I'll also be needing to specify equivalents for pThen3 & pThen4).
>
> The first isn't too bad...
>
> let pThen combine p1 p2 = fun ts ->
> let l1 = p1 ts in
> let l2 = List.map (fun (v1,ts1) -> p2 ts1) l1 in
> List.concat
> (List.map2 (fun (v1,ts1) l2 -> List.map (fun (v2,ts2) -> combine
> v1 v2,ts2) l2) l1 l2)
>
> As you can see, extending this style to pThen3 & pThen4 is going to be
> very, very ugly (and hard to get right first time).
>
> I know it's just shorthand for map/filter, (and more complex
> derivatives of these), but it would be nice to have in ocaml...
>
> BTW: any suggestions on a better way to write the above function would
> be appreciated
There's a camlp4 lib for this:
http://oandrieu.nerim.net/ocaml/#pa_compr
If you use ocamlfind, you might want install it with p4ck, which also
installs a few other camlp4 hacks from various authors.
(http://martin.jambon.free.fr/p4ck.html)
Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/32689/focus=32689
Richard Jones announced:
We are pleased to announce new versions of the HostIP and Weblogs
libraries. Particular improvements concentrate on the ability to
handle very large amounts of data - eg. web servers generating 5
million hits / day or more.
http://merjis.com/developers/hostip
http://merjis.com/developers/weblogs
HostIP is an OCaml module for looking up geolocation data from IP
addresses. It uses the community HostIP project. (http://hostip.info)
Weblogs is an OCaml module for importing weblogs from Apache or IIS
web servers.
The APIs are described here:
http://resources.merjis.com/developers/hostip/HostIP.html
http://resources.merjis.com/developers/weblogs/Weblogs.html
The libraries are both released under GNU LGPL w/ OCaml linking
exception.
Archive: http://thread.gmane.org/gmane.comp.lang.caml.general/32691/focus=32691
David Allsopp asked and Richard Jones answered:
> Has anyone successfully compiled bindings for PostgreSQL under Windows XP?
> I'm using OCaml 3.09 (MinGW binaries, Cygwin installed) and PostgreSQL 8.1.3
> running locally but am having no joy trying to compile
> postgresql-ocaml-1.5.0
You could try PG'OCaml. It might be better, because it's pure OCaml,
so requires no external libs. However it still builds using Makefile
(GNU make) so you might need to adapt the relatively simple build
system to use whatever works on Windows.
http://merjis.com/developers/pgocaml
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}$'?'<1':1
zM
If you know of a better way, please let me know.
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.