[cwn] Attn: Development Editor, Latest Caml Weekly News

Alan Schmitt alan.schmitt at polytechnique.org
Tue Nov 3 04:59:34 PST 2009


Hello,

Here is the latest Caml Weekly News, for the week of October 27 to November
03, 2009.

1) forbidden construct as right hand side of "let rec"
2) ocaml-gettext v0.3.3
3) Other Caml News

========================================================================
1) forbidden construct as right hand side of "let rec"
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
========================================================================
2) ocaml-gettext v0.3.3
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>
========================================================================
3) Other Caml News
------------------------------------------------------------------------
** From the ocamlcore planet blog:

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>

========================================================================
Old cwn
------------------------------------------------------------------------

If you happen to miss a CWN, you can send me a message
(alan.schmitt at polytechnique.org) and I'll mail it to you, or go take a look
at
the archive (<http://alan.petitepomme.net/cwn/>) or the RSS feed of the
archives (<http://alan.petitepomme.net/cwn/cwn.rss>). If you also wish
to receive it every week by mail, you may subscribe online at
<http://lists.idyll.org/listinfo/caml-news-weekly/> .

========================================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/caml-news-weekly/attachments/20091103/0908201a/attachment.html>


More information about the caml-news-weekly mailing list