<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hello,</div><div><br class="webkit-block-placeholder"></div><div>Here is the latest Caml Weekly News, for the week of December 04 to December 11, 2007.</div><div><br class="webkit-block-placeholder"></div><div>1) Job announcement -- Ocaml &amp; C hacker</div><div>2) The Caml vs. the Leopard</div><div>3) Ocaml code for Okasaki's "Purely Functional Data Structures"</div><div>4) Questions on replacing finalizers and memory footprints</div><div>5) PLplot library bindings</div><div>6) LablGL 1.03</div><div><br class="webkit-block-placeholder"></div><div>========================================================================</div><div>1) Job announcement -- Ocaml &amp; C hacker</div><div>Archive: &lt;<a href="http://groups.google.com/group/fa.caml/browse_frm/thread/a967497d00894c5f#0b2af984b97b1c2b">http://groups.google.com/group/fa.caml/browse_frm/thread/a967497d00894c5f#0b2af984b97b1c2b</a>&gt;</div><div>------------------------------------------------------------------------</div><div>** Berke Durak announced:</div><div><br class="webkit-block-placeholder"></div><div>Exalead is a French software editor based in central Paris and&nbsp;</div><div>developing enterprise search solutions and a web search engine&nbsp;</div><div>(&lt;<a href="http://exalead.fr/">http://exalead.fr/</a>&gt;). &nbsp;Our young teams include web, natural language,&nbsp;</div><div>indexing, database and network specialists. &nbsp;We count a good number of&nbsp;</div><div>C hackers.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>We develop an important part of our software in Exascript, our&nbsp;</div><div>extension of Java. &nbsp;Currently, we are rewriting our compiler in Ocaml&nbsp;</div><div>(it was originally written in C) and targeting the Java virtual&nbsp;</div><div>machine (instead of our in-house virtual machine).&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>To help with this task, Exalead is looking for a good hacker fluent in&nbsp;</div><div>Ocaml and C. &nbsp;Having some familiarity with Java and its virtual&nbsp;</div><div>machine is a plus.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>We are looking for someone who:&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>- has an excellent grasp of low-level systems programming in C,&nbsp;</div><div>- has been hacking Ocaml for some time,&nbsp;</div><div>- has an understanding of garbage-collected virtual machines, and the&nbsp;</div><div>&nbsp;&nbsp; way they interact with native code,&nbsp;</div><div>- is familiar with compilation techniques,&nbsp;</div><div>- and likes to work in small teams and without formal specifications.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>Tasks to be expected are as follows.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>- Participate in the development of the Exascript compiler in a small&nbsp;</div><div>&nbsp;&nbsp; team of two to four people.&nbsp;</div><div>- Ensure that existing native C and C++ application-level code works&nbsp;</div><div>&nbsp;&nbsp; smoothly on the JVM.&nbsp;</div><div>- Examine the code base to detect parts that can be difficult to port,&nbsp;</div><div>&nbsp;&nbsp; possibly by developing automated analysis tools.&nbsp;</div><div>- Devise, run and interpret benchmarks, deduce possible optimizations&nbsp;</div><div>&nbsp;&nbsp; and implement them.&nbsp;</div><div>- Adapt and rewrite the base libraries to run under the JVM, using&nbsp;</div><div>&nbsp;&nbsp; existing Java components if possible.&nbsp;</div><div>- Adapt developer tools to work smoothly with Exascript (such as Emacs&nbsp;</div><div>&nbsp;&nbsp; modes or Eclipse plug-ins).&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>This is a permanent position for a full-time job.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>If you are interested, write to <a href="mailto:berke.durak@exalead.com">berke.durak@exalead.com</a></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>========================================================================</div><div>2) The Caml vs. the Leopard</div><div>Archive: &lt;<a href="http://groups.google.com/group/fa.caml/browse_frm/thread/92e8f5867182417a#2c18da30c9a031bc">http://groups.google.com/group/fa.caml/browse_frm/thread/92e8f5867182417a#2c18da30c9a031bc</a>&gt;</div><div>------------------------------------------------------------------------</div><div>** Gordon Henriksen announced:</div><div><br class="webkit-block-placeholder"></div><div>Good news for Mac users and early adopters! Ocaml versions in CVS now compile&nbsp;</div><div>cleanly on Leopard with or without setenv MACOSX_DEPLOYMENT_TARGET 10.4. To&nbsp;</div><div>get the code:</div><div><br class="webkit-block-placeholder"></div><div># HEAD branch</div><div>cvs -d :pserver:<a href="mailto:anoncvs@camlcvs.inria.fr">anoncvs@camlcvs.inria.fr</a>:/caml co ocaml -d ocaml-3.11.x</div><div><br class="webkit-block-placeholder"></div><div># release310 branch</div><div>cvs -d :pserver:<a href="mailto:anoncvs@camlcvs.inria.fr">anoncvs@camlcvs.inria.fr</a>:/caml co -r release310 ocaml -d ocaml-3.10.x</div><div><br class="webkit-block-placeholder"></div><div>This isn't a release yet, so run at your own risk. Thanks for hacking that&nbsp;</div><div>patch into shape, Xavier.</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>========================================================================</div><div>3) Ocaml code for Okasaki's "Purely Functional Data Structures"</div><div>Archive: &lt;<a href="http://groups.google.com/group/fa.caml/browse_frm/thread/a374fa6c9d9a7917#842ac97335a24ec6">http://groups.google.com/group/fa.caml/browse_frm/thread/a374fa6c9d9a7917#842ac97335a24ec6</a>&gt;</div><div>------------------------------------------------------------------------</div><div>** Erik de Castro Lopo asked and Paolo Donadeo answered:</div><div><br class="webkit-block-placeholder"></div><div>&gt; I'm currently reading Okasaki's book and a bit of googling told me&nbsp;</div><div>&gt; that Markus Mottl translated the code examples into Ocaml.&nbsp;</div><div>&gt; Unfortunately the links to the code are all dead. Does anybody have&nbsp;</div><div>&gt; this code somewhere or know where it might be available?&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>Try here, it's the OCaml page of Markus Mottl:&nbsp;</div><div>&lt;<a href="http://ocaml.info/home/ocaml_sources.html">http://ocaml.info/home/ocaml_sources.html</a>&gt;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>** Ashish Agarwal then asked and Maxence Guesdon answered:</div><div><br class="webkit-block-placeholder"></div><div>&gt; How do items on the Hump get updated? Markus Mottl's libraries are obviously&nbsp;</div><div>&gt; a valuable resource, but the Hump's information for at least a few of his&nbsp;</div><div>&gt; libraries are out of date. Unfortunate for newbies who don't know about the&nbsp;</div><div>&gt; above link.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>The better way to have the hump updated is to&nbsp;</div><div>- send an email to <a href="mailto:hump@caml.inria.fr">hump@caml.inria.fr</a>,&nbsp;</div><div>- or announce new software or updates on the caml-list, so I can add it to&nbsp;</div><div>or update the hump.</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>========================================================================</div><div>4) Questions on replacing finalizers and memory footprints</div><div>Archive: &lt;<a href="http://groups.google.com/group/fa.caml/browse_frm/thread/818e4443c627d478#9e1988d25a4e0cb9">http://groups.google.com/group/fa.caml/browse_frm/thread/818e4443c627d478#9e1988d25a4e0cb9</a>&gt;</div><div>------------------------------------------------------------------------</div><div>** Thomas Fischbacher asked and Richard Jones answered:</div><div><br class="webkit-block-placeholder"></div><div>&gt; Also, is there a simple way to implement a function (perhaps using&nbsp;</div><div>&gt; Obj.magic) which will walk a (possibly circular) network of tuples,&nbsp;</div><div>&gt; arrays, variadic entities and lists, and return the total number of&nbsp;</div><div>&gt; bytes used up by that structure? I see that this should be possible&nbsp;</div><div>&gt; in principle with the present implementation of the runtime if one&nbsp;</div><div>&gt; could get some basic information about the internal type of an array.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>You might get some ideas by having a look at the ancient module&nbsp;</div><div>(&lt;<a href="http://merjis.com/developers/ancient">http://merjis.com/developers/ancient</a>&gt;), specifically at how the C&nbsp;</div><div>function _mark in ancient_c.c is implemented. &nbsp;Also have a look at the&nbsp;</div><div>implementation of the Marshal module in the OCaml sources which takes&nbsp;</div><div>a slightly different approach.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>If you want to do this in pure OCaml, probably your best bet would be&nbsp;</div><div>to just Marshal the structure and count how big it is. &nbsp;It'll be slow&nbsp;</div><div>of course.</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>** Thomas Fischbacher then said and Jon Harrop added:</div><div><br class="webkit-block-placeholder"></div><div>&gt; Actually, the situation that brought up this question is that I have a&nbsp;</div><div>&gt; complicated internal data structure which will free 300 MB of RAM if I&nbsp;</div><div>&gt; delete it, while serializing it produces a file of 94 MB only...&nbsp;</div><div>&gt; So, I would like to have more clarity what is going on here, and which&nbsp;</div><div>&gt; part of this data structure eats how much space.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>I had never though of measuring the size of a marshalled data structure. Turns&nbsp;</div><div>out its representation of ints can be more concise than the code&nbsp;</div><div>representation though:&nbsp;</div><div><br class="webkit-block-placeholder"></div><div># String.length (Marshal.to_string (Array.make 1000000 0) []);;&nbsp;</div><div>- : int = 1000025&nbsp;</div><div># String.length (Marshal.to_string (Array.make 1000000 123456789) []);;&nbsp;</div><div>- : int = 5000025&nbsp;</div><div># String.length (Marshal.to_string (Array.make 1000000 max_int) []);;&nbsp;</div><div>- : int = 9000025&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>which is probably what you're observing.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>Marshalling also handles sharing but that seems to refer to DAGs in memory&nbsp;</div><div>rather than hash consing:&nbsp;</div><div><br class="webkit-block-placeholder"></div><div># String.length (Marshal.to_string (Array.make 1000000 0., Array.make 1000000&nbsp;</div><div>0.) []);;&nbsp;</div><div>- : int = 16000031</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>** Xavier Leroy answered the OP:</div><div><br class="webkit-block-placeholder"></div><div>&gt; Also, is there a simple way to implement a function (perhaps using&nbsp;</div><div>&gt; Obj.magic) which will walk a (possibly circular) network of tuples,&nbsp;</div><div>&gt; arrays, variadic entities and lists, and return the total number of&nbsp;</div><div>&gt; bytes used up by that structure? I see that this should be possible&nbsp;</div><div>&gt; in principle with the present implementation of the runtime if one&nbsp;</div><div>&gt; could get some basic information about the internal type of an&nbsp;</div><div>&gt; array.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>Jean-Christophe Filliātre's "size" library does exactly this:&nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &lt;<a href="http://www.lri.fr/~filliatr/software.en.html">http://www.lri.fr/~filliatr/software.en.html</a>&gt;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>** Jean-Christophe Filliātre then said:</div><div><br class="webkit-block-placeholder"></div><div>Indeed. However, note that it uses internally a hash table to store&nbsp;</div><div>blocks already considered (in order to correctly account for sharing),&nbsp;</div><div>and thus it is potentially incorrect if the GC moves some blocks during&nbsp;</div><div>the count, for instance during a resizing of the hash table (which&nbsp;</div><div>triggers the GC). I don't know how to avoid this issue; any help is welcome.</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>** Berke Durak also replied:</div><div><br class="webkit-block-placeholder"></div><div>I once had more or less the same problem in the EDOS project with huge&nbsp;</div><div>data structures.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>Filliātre's size library was also growing too large a hashtable,&nbsp;</div><div>so I decided to use something else.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>My solution was to marshal the data structure and then analyze the&nbsp;</div><div>marshalled data by recomputing its type.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>You first write a TYPER module that represents the types in your&nbsp;</div><div>marshalled data structure, then use the Analyzer module on your&nbsp;</div><div>output.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>I was more interested in the size strings were taking in memory,&nbsp;</div><div>but it should be easy to modify. &nbsp;All the ugly parts (parsing the&nbsp;</div><div>marshal format, and the combinators for describing the types)&nbsp;</div><div>have been defined.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>&lt;<a href="https://protactinium.pps.jussieu.fr:12345/svn/edos/users/berke/dvhfz/analyze.ml">https://protactinium.pps.jussieu.fr:12345/svn/edos/users/berke/dvhfz/analyze.ml</a>&gt;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>========================================================================</div><div>5) PLplot library bindings</div><div>Archive: &lt;<a href="http://groups.google.com/group/fa.caml/browse_frm/thread/b11096c05bce6a56#7da616bfabd6f76f">http://groups.google.com/group/fa.caml/browse_frm/thread/b11096c05bce6a56#7da616bfabd6f76f</a>&gt;</div><div>------------------------------------------------------------------------</div><div>** Hezekiah M. Carty announced:</div><div><br class="webkit-block-placeholder"></div><div>I would like to announce the availability of some reasonably complete&nbsp;</div><div>OCaml bindings for the PLplot data plotting library [1].&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>These are separate from previously announced PLplot bindings [2] -&nbsp;</div><div>those used SWIG to generate the interface, while this set of bindings&nbsp;</div><div>uses camlidl. &nbsp;These bindings are also somewhat more complete.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>The code can be downloaded from:&nbsp;</div><div>&lt;<a href="http://code.google.com/p/ocaml-plplot/">http://code.google.com/p/ocaml-plplot/</a>&gt;&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>Requirements:&nbsp;</div><div>- OCaml (tested with 3.10.0, should work on older versions?)&nbsp;</div><div>- PLplot version 5.7.x or 5.8.x&nbsp;</div><div>- camlidl&nbsp;</div><div>- findlib&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>The license is the same as PLplot (LGPLv2+).&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>This code has been developed on a 32bit CentOS 5 system, using godi&nbsp;</div><div>for the OCaml installation. &nbsp;I would be happy to hear about any&nbsp;</div><div>successes or failures on other systems.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>There is currently only one example included, which corresponds to&nbsp;</div><div>example 11 on the PLplot website. &nbsp;The PLplot documentation is a good&nbsp;</div><div>reference as this binding is very close to the C library. &nbsp;There are&nbsp;</div><div>some OCaml specific items though, so feel free to ask if you have&nbsp;</div><div>questions or problems.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>Enjoy!&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>[1] - &lt;<a href="http://plplot.sourceforge.net/">http://plplot.sourceforge.net/</a>&gt;&nbsp;</div><div>[2] - &lt;<a href="http://vityok.org.ua/cgi-bin/odd.cgi/Ocaml-plplot">http://vityok.org.ua/cgi-bin/odd.cgi/Ocaml-plplot</a>&gt;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>========================================================================</div><div>6) LablGL 1.03</div><div>Archive: &lt;<a href="http://groups.google.com/group/fa.caml/browse_frm/thread/34efc309ece49f80#853cdba29b09101a">http://groups.google.com/group/fa.caml/browse_frm/thread/34efc309ece49f80#853cdba29b09101a</a>&gt;</div><div>------------------------------------------------------------------------</div><div>** Jacques Garrigue announced:</div><div><br class="webkit-block-placeholder"></div><div>Since it seems that it contains some useful bug fixes,&nbsp;</div><div>here is a new release of LablGL.&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>The main changes are:&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>2007-04-13:&nbsp;</div><div>* add glPolygonOffset&nbsp;</div><div>* fix Glut.createMenu&nbsp;</div><div>* fix GlTex.gen_textures&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>2006-07-29:&nbsp;</div><div>* make LablGlut's callback window dependent&nbsp;</div><div>* simplify glutInit&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>You can find it at:&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>&nbsp;&nbsp;&lt;<a href="http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgl.html">http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgl.html</a>&gt;&nbsp;</div><div><br class="webkit-block-placeholder"></div><div>There is a (semi-)binary release for windows, with both Togl and Glut&nbsp;</div><div>support, that can be used directly with the OCaml MSVC or mingw&nbsp;</div><div>ports. ocamlopt is supported too, with the exception of Togl on mingw.&nbsp;</div><div>(Read carefully the installation instructions, particularly for ocaml&nbsp;</div><div>3.10)</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>========================================================================</div><div>Using folding to read the cwn in vim 6+</div><div>------------------------------------------------------------------------</div><div>Here is a quick trick to help you read this CWN if you are viewing it using</div><div>vim (version 6 or greater).</div><div><br class="webkit-block-placeholder"></div><div>:set foldmethod=expr</div><div>:set foldexpr=getline(v:lnum)=~'^=\\{78}$'?'&lt;1':1</div><div>zM</div><div>If you know of a better way, please let me know.</div><div><br class="webkit-block-placeholder"></div><div>========================================================================</div><div>Old cwn</div><div>------------------------------------------------------------------------</div><div><br class="webkit-block-placeholder"></div><div>If you happen to miss a CWN, you can send me a message</div><div>(<a href="mailto:alan.schmitt@polytechnique.org">alan.schmitt@polytechnique.org</a>) and I'll mail it to you, or go take a look at</div><div>the archive (&lt;<a href="http://alan.petitepomme.net/cwn/">http://alan.petitepomme.net/cwn/</a>&gt;) or the RSS feed of the</div><div>archives (&lt;<a href="http://alan.petitepomme.net/cwn/cwn.rss">http://alan.petitepomme.net/cwn/cwn.rss</a>&gt;). If you also wish</div><div>to receive it every week by mail, you may subscribe online at</div><div>&lt;<a href="http://lists.idyll.org/listinfo/caml-news-weekly/">http://lists.idyll.org/listinfo/caml-news-weekly/</a>&gt; .</div><div><br class="webkit-block-placeholder"></div><div>========================================================================</div><div><br></div><div class="AppleMailSignature" id="E12A09DE-ADCF-40D6-B7D4-306ED5CADD30"><div>--&nbsp;</div><div>Alan Schmitt &lt;<a href="http://alan.petitepomme.net/">http://alan.petitepomme.net/</a>&gt;</div><div><br class="khtml-block-placeholder"></div><div>The hacker: someone who figured things out and made something cool happen.</div><div>&nbsp;.O.</div><div>&nbsp;..O</div><div>&nbsp;OOO</div><br class="Apple-interchange-newline"> </div><br></body></html>