Caml Weekly News
[Posted November 3, 2009 by cook]
| From: |
| Alan Schmitt <alan.schmitt-AT-polytechnique.org> |
| To: |
| lwn-AT-lwn.net, cwn-AT-lists.idyll.org |
| Subject: |
| Attn: Development Editor, Latest Caml Weekly News |
| Date: |
| Tue, 3 Nov 2009 13:59:34 +0100 |
| Message-ID: |
| <25ec8ca60911030459n745d0347j5feedf1bad88e506@mail.gmail.com> |
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/thre...
>
------------------------------------------------------------------------
** 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/thre...
>
------------------------------------------------------------------------
** 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-gettex...>
========================================================================
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...>
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/bla...>
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@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/> .
========================================================================