Hello
Here is the latest Caml Weekly News, for the week of October 27 to November 03, 2009.
Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/a6696d235d8843a5#
Mathias Kende and Lukasz Stafiniak asked, and Xavier Leroy answered:Mathias Kende wrote: > I need to write something like this : > > let f f i = if i = 0 then 1 else i * f (i - 1) > let rec g = f g > > Of course the compiler won't let me write it (even if the OCaml type > system is happy): > "This kind of expression is not allowed as right-hand side of `let rec'" In general, the best thing to do in this case is to switch to lazy evaluation: # let f f i = if i = 0 then 1 else i * Lazy.force f (i-1);; val f : (int -> int) Lazy.t -> int -> int = <fun> # let rec g' = lazy (f g');; val g' : (int -> int) Lazy.t = <lazy> # let g = Lazy.force g';; val g : int -> int = <fun> # g 10;; - : int = 3628800 Lukasz Stafiniak wrote: > While we are at it, what is the best way to convert a "straight" list > into a cyclic list? > > i.e. convert > > let l = a::b::[] > > into > > let rec l = a::b::l > > (for arbitrary length lists). (The answer I recall from the archives > was using Obj.magic to mutate the [] in the original list). Obj.magic is not part of the OCaml language :-) Again, you can do that just fine using lazy lists instead of lists: type 'a lazylist = 'a lazylist_content Lazy.t and 'a lazylist_content = Nil | Cons of 'a * 'a lazylist
Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/ee192e030bf1e9b7#
Sylvain Le Gall announced:General: ocaml-gettext is a library that enables string translation in OCaml. The API is based on GNU gettext. It comes with a tool to extract strings which need to be translated from OCaml source files. This enables OCaml program to output string in the native language of the user, if a corresponding translation file of the English strings is provided. Changes: v 0.3.3 is a bug fix release: * compatible with ocaml-fileutils 0.4.0 * more static type-check of format string Links: http://le-gall.net/sylvain+violaine/ocaml-gettext.html http://le-gall.net/sylvain+violaine/download/ocaml-gettext-0.3.3.tar.gz
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/. OCaml-gettext 0.3.3: http://caml.inria.fr/cgi-bin/hump.cgi?contrib=436 It’s coming: http://dutherenverseauborddelatable.wordpress.com/2009/11/01/its-coming/ Liquidsoap 0.9.2 is out !: http://blog.rastageeks.org/spip.php?article52 BlackBerry OS 5.0 and the Storm: http://feedproxy.google.com/~r/Skydeck/~3/gtTzD9h8p_s/blackberry-os5-storm XML or S-expressions?: http://rwmj.wordpress.com/2009/10/30/xml-or-s-expressions/ ocamlbuild example repository: http://forge.ocamlcore.org/projects/obuild-examples/ New HLVM GC and LLVM 2.6 support: http://forge.ocamlcore.org/forum/forum.php?forum_id=449
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.