<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Il y a du thé renversé au bord de la table &#187; OCaml</title>
	<atom:link href="http://dutherenverseauborddelatable.wordpress.com/category/ocaml/feed/" rel="self" type="application/rss+xml" />
	<link>http://dutherenverseauborddelatable.wordpress.com</link>
	<description>De l'actualité, de l'informatique, de l'enseignement, d'intenses réflexions et quelques autres absurdités</description>
	<lastBuildDate>Mon, 27 Apr 2009 10:42:36 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>fr</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
		<url>http://www.gravatar.com/blavatar/b4f8dbeb495eaa4c8ee77515c06383c8?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Il y a du thé renversé au bord de la table &#187; OCaml</title>
		<link>http://dutherenverseauborddelatable.wordpress.com</link>
	</image>
			<item>
		<title>Last lecture</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2009/04/22/last-lecture/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2009/04/22/last-lecture/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 14:17:33 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Enseignement]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[OCaml]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[Réforme des universités]]></category>
		<category><![CDATA[Société]]></category>
		<category><![CDATA[chercheur]]></category>
		<category><![CDATA[chercheurs]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[enseignant]]></category>
		<category><![CDATA[enseignant-chercheur]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[glandeur]]></category>
		<category><![CDATA[gouvernement]]></category>
		<category><![CDATA[grève]]></category>
		<category><![CDATA[liquidator]]></category>
		<category><![CDATA[loi pécresse]]></category>
		<category><![CDATA[marre]]></category>
		<category><![CDATA[politique]]></category>
		<category><![CDATA[programmation]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming languages]]></category>
		<category><![CDATA[raz-le-bol]]></category>
		<category><![CDATA[rébellion]]></category>
		<category><![CDATA[réforme des universités]]></category>
		<category><![CDATA[recherche]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[science]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[static analysis]]></category>
		<category><![CDATA[université]]></category>
		<category><![CDATA[universités]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=571</guid>
		<description><![CDATA[Note: This post is written on the 79th day of strike of Universities. Despite the overwhelming consensus against these bills, the government has just passed the application decrees implementing the possibility of arbitrarily increasing the teaching charge of researchers, without need for any justification. The government obviously fails to see how much this will hurt [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=571&subd=dutherenverseauborddelatable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;"><strong>Note:</strong> <em>This post is written on the 79th day of strike of Universities. Despite the overwhelming consensus against these bills, <a href="http://www.sauvonsluniversite.com/spip.php/dist/dist/IMG/dist/local/cache-vignettes/L134xH100/plugins/dw2/%22http:/www.auboutduweb.com/poolp/dist/dist/plugins/dw2/dist/ecrire/dist/dist/IMG/doc/dist/IMG/doc/dist/IMG/doc/dist/ecrire/dist/dist/IMG/doc/dist/dist/spip.php?article2448">the government has just passed the application decrees implementing the possibility of arbitrarily increasing the teaching charge of researchers, without need for any justification</a>. The government obviously fails to see how much this will hurt Research. Simultaneously, the government has announced that, since the reform of primary and secondary schools cannot proceed in compliance with the government&#8217;s own decrees, <a href="http://www.education.gouv.fr/cid24445/reforme-du-recrutement-et-de-la-formation-des-maitres.html">it will simply proceed illegally</a>. Once the shock is gone, expect increased strike actions. Expect Resarch strikes on publications, on patents, on contracts with the government or French companies. Expect difficulties with baccalauréat, exams and degrees.</em></p>
<p style="text-align:justify;">Where headhunters had failed, the government has finally succeeded<em>.</em> Today was my last lecture.</p>
<p style="text-align:justify;">As the government obviously doesn&#8217;t want Researchers to have the means and time to undertake Research, I have accepted a position in the private sector, where I should be able to pursue my work on semantics, security and functional concurrent/distributed programming languages.</p>
<p style="text-align:justify;">While I&#8217;m glad to start in a position where I will have both more leeway and both students and engineers to work with me, I am saddened that the situation had to reach the point where I felt I had no choice.</p>
<p style="text-align:justify;">Barring any accident, starting September 1st, you will be able to find me at <a href="http://www.mlstate.com">MLState</a>.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/571/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=571&subd=dutherenverseauborddelatable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2009/04/22/last-lecture/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>OCaml Batteries Included Beta 1</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2009/04/06/ocaml-batteries-included-beta-1/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2009/04/06/ocaml-batteries-included-beta-1/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 10:24:32 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[OCaml]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[batteries included]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[glandeur]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[jean foutre]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[programmation]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming languages]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=545</guid>
		<description><![CDATA[Note This post is written on the 64th day of University strikes in France. During these 64 days, the government has rejected any negociation on the core reasons for the strike, has attempted to discredit the contestation (if I understand correctly, I am both « improductive » and a « mask-wearing commando ») and has [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=545&subd=dutherenverseauborddelatable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;"><strong>Note</strong> <em>This post is written on the 64th day of University strikes in France. During these 64 days, the government has rejected any negociation on the core reasons for the strike, has attempted to discredit the contestation (if I understand correctly, I am both « improductive » and a « mask-wearing commando ») and has used police intimidation and repression. The strike continues. Quite possibly, there will be no university exams this year and no baccalauréat. If repression continues increasing, no one can tell for sure what will happen. Nothing good, for sure.</em></p>
<p style="text-align:justify;">After days and nights of coding, debugging and fighting over naming conventions, the OCaml Batteries Included team is proud to announce OCaml Batteries Included Beta 1. You can find the binaries <a href="https://forge.ocamlcore.org/frs/?group_id=17&amp;release_id=117">here</a>,  read <a href="http://batteries.forge.ocamlcore.org/doc.preview:batteries-beta1/html/api/index.html">the API documentation</a>, the platform documentation, <a href="https://forge.ocamlcore.org/frs/shownotes.php?release_id=117">the release notes and the ChangeLog</a> or <a href="http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=batteries/batteries.git">the list of individual commits</a>. A GODI package and a Debian/testing package are also available.</p>
<h2 style="text-align:justify;"><span id="more-545"></span>So, what&#8217;s new in Beta 1?</h2>
<h3 style="text-align:justify;">API freeze</h3>
<p style="text-align:justify;">Firstly, from now on, barring trivial changes and bugfixes, the API should be stable. So it&#8217;s a good time to start testing it with your projects and <a href="http://forge.ocamlcore.org/tracker/?atid=151&amp;group_id=17&amp;func=browse">submitting bug reports</a>.</p>
<h3 style="text-align:justify;">Command-line tools</h3>
<p style="text-align:justify;">OCaml Batteries Included already had a drop-in replacement for ocamlc and ocamlopt, to automatically open, load and link all the necessary libraries and/or syntax extensions. To invoke them, use</p>
<pre name="code" class="php">

$ ocamlfind batteries/ocamlc foo.ml
</pre>
<p>or</p>
<pre name="code" class="php">

$ ocamlfind batteries/ocamlopt foo.ml
</pre>
<p>They behave essentially as their counterparts in the INRIA distribution.</p>
<p style="text-align:justify;">Ok, that&#8217;s not new. What&#8217;s new is that OCaml Batteries Included now also has a drop-in replacement for ocaml, ocamldep and ocamlbuild. To launch the toplevel, run</p>
<pre name="code" class="php">

$ ocamlfind batteries/ocaml
</pre>
<p>or to use it as an interpreter</p>
<pre name="code" class="php">

$ ocamlfind batteries/ocaml foo.ml
</pre>
<p>Similarly, you may now use the ocamlbuild replacement</p>
<pre name="code" class="php">

$ ocamlfind batteries/ocamlbuild foo.byte
</pre>
<p>or</p>
<pre name="code" class="php">

$ ocamlfind batteries/ocamlbuild foo.native
</pre>
<p style="text-align:justify;">What does this mean? Well, essentially, it means that you don&#8217;t have to do any complex configuration to take advantage of OCaml Batteries Included. Just replace every use of ocaml/ocamlc/ocamlopt/ocamlbuild with the corresponding drop-in replacement.</p>
<h3 style="text-align:justify;">Toplevel</h3>
<p style="text-align:justify;">Since Alpha 2, the OCaml Batteries Included toplevel gives access to the manual, using directive <code>#man</code>. With Beta 1, a new directive <code>#browse</code> appears. This directive lets you insepct the contents of a module, regardless of whether the documentation has been generated:</p>
<pre name="code" class="php">

$ rlwrap ocamlfind batteries/ocaml
        Objective Caml version 3.11.0

      _________________________________
     |       | |                       |
    [| +     | | Batteries Included  - |
     |_______|_|_______________________|
      __________________________________
     |                       | |        |
     | -    Type &#039;#help;;&#039;   | |      + |]
     |_______________________|_|________|

# #browse &quot;List&quot;;;
module List :
  sig
    type &#039;a t = &#039;a list
    type &#039;a enumerable = &#039;a t
    type &#039;a mappable = &#039;a t
    val length : &#039;a list -&gt; int
    val hd : &#039;a list -&gt; &#039;a
    val tl : &#039;a list -&gt; &#039;a list
    val is_empty : &#039;a list -&gt; bool
    (*...*)
end
</pre>
<p>This directive is provided as a quick way of understanding complex and undocumented modules &#8212; say, Camlp4.</p>
<h3>Printf replacement</h3>
<p style="text-align:justify;">OCaml has long provided a useful but awkward Printf module. A few versions ago, OCaml Batteries Included introduced a partial replacement for Printf, more extensible and more compsable. With OCaml Batteries Included Beta 1, we now have a complete replacement, which is both safer, lightweight and more extensible. Let&#8217;s take a look :</p>
<pre name="code" class="php">

# let format = p&quot;Let&#039;s print a string: %s\n&quot;;;
val format : (string -&gt; &#039;a, &#039;a) Batteries.Print.format =
  {Batteries.Print.pattern = &quot;Let&#039;s print a string:%(0)\n&quot;;
   Batteries.Print.printer = &lt;fun&gt;}
# Print.printf format &quot;some text&quot;;;
Let&#039;s print a string: some text
- : unit = ()
</pre>
<p>Up to this point, there&#8217;s not much difference with the usual Printf module. But the nice thing is that this is completely extensible. It can be used just as well to print, say, lists:</p>
<pre name="code" class="php">

# Print.printf p&quot;Here&#039;s a list of integers: %{int list}\n&quot; [1;2;3;4;5];;
Here&#039;s a list of integers: [1; 2; 3; 4; 5]
- : unit = ()
</pre>
<p style="text-align:justify;">Of course, this works just as well with arrays, ropes, and, well, just about every single data structure, including your own. You can add new printing functions, overload printing locally, etc.</p>
<h3>And more</h3>
<ul>
<li>The OCaml Batteries Included toplevel now supports a .ocamlinit file, which can take advantage of all the features of Batteries.</li>
<li>Previous versions of OCaml Batteries Included introduced syntactic construction
<pre name="code" class="php">

open List include Labels
</pre>
<p>to create a new local module <code>List</code> containing the code of <code>List</code> and that of <code>Labels</code>. Due to ambiguities, the syntax was changed to</p>
<pre name="code" class="php">

open List with Labels
</pre>
</li>
<li>UTF-8 literal strings are now validated at compile-time</li>
<li>Conversion between Latin-1 literal strings and UTF-8 is now performed at compile-time</li>
<li>Modules Digest, Scanf, Format, Lexing now compatible with Batteries I/O</li>
<li>New out-of-the-box modules StringSet, IntSet, StringMap, IntMap, etc.</li>
<li>New module Future.Logger</li>
<li>The interpreter may now be called as a library</li>
<li>Improvements to Random, Enum, Bigarray, String, String.Cap, Set, PSet, &#8230;</li>
<li>Speed improvements in LazyList, Rope, String</li>
<li>Test suite</li>
<li>Build improvements, including parallel build, better detection of default directories</li>
<li>Numerous bugfixes</li>
<li>etc.</li>
</ul>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/545/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=545&subd=dutherenverseauborddelatable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2009/04/06/ocaml-batteries-included-beta-1/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>On-line interpreter for Batteries</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2009/03/25/on-line-interpreter-for-batteries/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2009/03/25/on-line-interpreter-for-batteries/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 08:57:05 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Enseignement]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[OCaml]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[batteries included]]></category>
		<category><![CDATA[functi]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming languages]]></category>
		<category><![CDATA[research]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=482</guid>
		<description><![CDATA[Note This entry is written on the 51st day of nationwide strike in French Universities and Research laboratories. Still no sign of negociation from the government. Liquidation of the system continues.
I am happy to announce that the repository version of OCaml Batteries Included now has a full-featured (and working) interpreter.

Toplevel (aka REPL aka interactive loop)
The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=482&subd=dutherenverseauborddelatable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;"><strong>Note</strong> This entry is written on the 51st day of nationwide strike in French Universities and Research laboratories. Still no sign of negociation from the government. Liquidation of the system continues.</p>
<p style="text-align:justify;">I am happy to announce that the repository version of OCaml Batteries Included now has a full-featured (and working) interpreter.</p>
<p style="text-align:justify;"><span id="more-482"></span></p>
<h2>Toplevel (aka <em>REPL</em> aka <em>interactive loop</em>)</h2>
<p>The toplevel has been available for some time in Batteries Included, but it has recently seen a lot of polish.</p>
<pre name="code" class="php">

~$ rlwrap ocamlfind batteries/ocaml
 Objective Caml version 3.11.0

  _________________________________
 |       | |                       |
[| +     | | Batteries Included  - |
 |_______|_|_______________________|
  _________________________________
 |                       | |       |
 | -    Type &#039;#help;;&#039;   | |     + |]
 |_______________________|_|_______|

# open Print;;
# printf p&quot;Hello %rope!\n&quot; r&quot;world&quot; ;;
Hello world!
- : unit = ()
</pre>
<p>Now is the right time to thank Warren Harris for the nice batteries logo and Jérémie Dimino for the new, extensible <code>printf</code> replacement.</p>
<p>Want to know more about that module?</p>
<pre name="code" class="php">

# #browse &quot;Print&quot;;;
module Print :
 sig
 type (&#039;a, &#039;b, &#039;c) directive =
 ((&#039;c Extlib.InnerIO.output -&gt; unit) -&gt; &#039;b) -&gt; &#039;a
 val literal : string -&gt; (&#039;a, &#039;a, &#039;b) directive
 type pattern = string
 val format :
 &#039;a Extlib.InnerIO.output -&gt;
 pattern -&gt; (&#039;a Extlib.InnerIO.output -&gt; unit) array -&gt; unit
 type (&#039;a, &#039;b, &#039;c) format =
 (&#039;a, &#039;b, &#039;c) Extlib.Print.format = {
 pattern : pattern;
 printer : pattern -&gt; (&#039;a, &#039;b, &#039;c) directive;
 }
 val printf : (&#039;a, unit, unit) format -&gt; &#039;a
 val eprintf : (&#039;a, unit, unit) format -&gt; &#039;a
 val fprintf : &#039;a Extlib.InnerIO.output -&gt; (&#039;b, unit, &#039;a) format -&gt; &#039;b
 val kfprintf :
 (&#039;a Extlib.InnerIO.output -&gt; &#039;b) -&gt;
 &#039;a Extlib.InnerIO.output -&gt; (&#039;c, &#039;b, &#039;a) format -&gt; &#039;c
 val rprintf : (&#039;a, Extlib.Rope.t, string) format -&gt; &#039;a
 val krprintf : (Extlib.Rope.t -&gt; &#039;a) -&gt; (&#039;b, &#039;a, string) format -&gt; &#039;b
 val sprintf : (&#039;a, string, string) format -&gt; &#039;a
 val ksprintf : (string -&gt; &#039;a) -&gt; (&#039;b, &#039;a, string) format -&gt; &#039;b
 val bprintf : Buffer.t -&gt; (&#039;a, unit, string) format -&gt; &#039;a
 val kbprintf :
 (Buffer.t -&gt; &#039;a) -&gt; Buffer.t -&gt; (&#039;b, &#039;a, string) format -&gt; &#039;b
 end
</pre>
<p>Ah, well, the signature may be a tad complex. But in fact, this was just a shameless plug for the new <code>#browse</code> directive, which I personally find quite useful. As usual, for more details, use <code>#man</code> to open the documentation.</p>
<h2>Script interpreter</h2>
<p style="text-align:justify;">Now, until recently, we couldn&#8217;t use Batteries Included to execute a script. This feature has recently been added by Peng Zang, Jérémie Dimino and Yours Truly.</p>
<p style="text-align:justify;">Which means that we can now run</p>
<pre name="code" class="php">

$ bocaml shuffle.ml Joe Jack William Averell
Jack William Averell Joe
</pre>
<p>(I&#8217;m cheating here, I have an alias from <code>bocaml</code> to <code>ocamlfind batteries/ocaml</code>, I assume you should&#8217;nt have difficulties doing the same if you use Batteries often).</p>
<p>In other news, we&#8217;re getting very close to a Beta release. Stay tuned for more info!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/482/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/482/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/482/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/482/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/482/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/482/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/482/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/482/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/482/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/482/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=482&subd=dutherenverseauborddelatable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2009/03/25/on-line-interpreter-for-batteries/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>OCaml Batteries Included, alpha 3</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2009/02/06/ocaml-batteries-included-alpha-3/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2009/02/06/ocaml-batteries-included-alpha-3/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 14:03:47 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[OCaml]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[batteries included]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=276</guid>
		<description><![CDATA[Dear programmers.
I am happy to inform you that, despite the in-progress liquidation of French Universities, OCaml Batteries Included Alpha 3 has landed. Barring any accident, this should be the final Alpha version, with a mostly stable API and module structure. You may now download it from the Forge. A GODI package is also available and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=276&subd=dutherenverseauborddelatable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Dear programmers.</p>
<p style="text-align:justify;">I am happy to inform you that, despite the in-progress liquidation of French Universities, OCaml Batteries Included Alpha 3 has landed. Barring any accident, this should be the final Alpha version, with a mostly stable API and module structure. You may now download it <a href="http://forge.ocamlcore.org/frs/?group_id=17&amp;release_id=73">from the Forge</a>. A GODI package is also available and a Debian package should follow soon. You may also read the documentation <a href="http://batteries.forge.ocamlcore.org/doc.preview:batteries-alpha3/html/index.html">on-line</a>.</p>
<p style="text-align:justify;">So, what&#8217;s new with Alpha 3? Plenty of things, as you&#8217;ll see.</p>
<p style="text-align:justify;"><span id="more-276"></span></p>
<h2 style="text-align:justify;">General</h2>
<ul style="text-align:justify;">
<li>OCaml Batteries Included is now available for both OCaml 3.10 and OCaml 3.11. Using OCaml 3.11 bring several additional features.</li>
</ul>
<h2>Language</h2>
<ul style="text-align:justify;">
<li>A new syntax extension allows merging several modules into one:
<pre name="code" class="php">

module List = List include Labels
</pre>
<p>gives name <code>List</code> to a new module containing both <code>List</code> and <code>Labels</code>. This extension should simplify the use of labels, exception-less extensions, etc.</li>
<li>General and extendable data structure comprehension:
<pre name="code" class="php">

[? i*i | i &lt;- 1 -- 100 ; i mod 2 = 0]
</pre>
<p>produces an enumeration containing all the squares of even numbers between 1 and 100, while</p>
<pre name="code" class="php">

[? String : c | c &lt;- open Char in &#039;a&#039; -- &#039;z&#039;]
</pre>
<p>produces string <code>"abcdefghijklmnopqrstuvwxyz"</code>. This works just as well with arrays, Unicode strings, Unicode ropes, doubly-linked lists, dynamic arrays, etc.</li>
<li>(OCaml 3.11 only) It is now possible to write Unicode strings, Unicode ropes, read-only strings, write-only strings, etc. Similarly, it is now possible to pattern-match against these strings with a natural syntax:
<pre name="code" class="php">

# u&quot;This is a Unicode string&quot;;;
- : Batteries.UTF8.t = u&quot;This is some Unicode string&quot;
# ro&quot;This is a read-only string&quot;;;
- : [`Read] Batteries.String.Cap.t = ro&quot;This is some Unicode string&quot;
# r&quot;This is a functional Unicode rope&quot;;;
- : Batteries.Rope.t = r&quot;This is a functional Unicode rope&quot;
</pre>
</li>
</ul>
<h2>Library</h2>
<ul style="text-align:justify;">
<li>After public consultation (<a href="http://groups.google.com/group/fa.caml/browse_thread/thread/9b398e9b774dce81/f86a5fe513eab0b8?q=hierarchy&amp;lnk=ol&amp;">1</a>, <a href="http://groups.google.com/group/fa.caml/browse_thread/thread/a7c9213fa2676410/ab9d4f3cc5d8eb1a?lnk=gst&amp;q=hierarchy#ab9d4f3cc5d8eb1a">2</a>), the module hierarchy has been completely rewritten into a mostly flat hierarchy, as per common OCaml usage.</li>
<li>New abstract thread-safe modules, to allow extensibility to e.g. coThreads.</li>
<li>Thread-safe version of the I/O library.</li>
<li>Old-style ArrayLabels, ListLabels, etc. have been replaced with Array.Labels, List.Labels, etc.</li>
<li>Plenty of new functions in Enum, Array, Hashtbl, Pervasives, String, Rope, Bingarray, Dllist, DynArray, Arg, Sys.</li>
<li>The File module now permits using temporary files.</li>
<li>New compatibility layer with OCamlNet.</li>
<li>New version of the Unix module, now compatible with I/O.</li>
<li>New module Future.Path for manipulating paths.</li>
<li>New module CharEncoding for transcoding inputs/outputs.</li>
<li>New module Date for manipulating time.</li>
</ul>
<h2>Documentation</h2>
<ul style="text-align:justify;">
<li>The new documentation allows browsing modules by topics. If this is successful, this will be generalized to browsing values, types, etc. by topics.</li>
<li>New documentation generator.</li>
<li>New explanations on a number of subjects.</li>
<li>A number of docfixes.</li>
</ul>
<h2>Bugfixes</h2>
<ul>
<li>A host of bugfixes, in particular wrt Enum.</li>
</ul>
<h2>Toplevel</h2>
<ul>
<li>Loading speed improved.</li>
<li>More robust implementation of the toplevel.</li>
<li>Pretty-printers for UChar, Rope, String.Cap, UTF8.t.</li>
<li>More robust implementation of the help system.</li>
</ul>
<h2>Examples</h2>
<ul>
<li>Beginning of reimplementation of <a href="http://pleac.sourceforge.net/">Pleac</a> in idiomatic OCaml Batteries Included.</li>
<li>Opening a web-browser from a program.</li>
<li>Text encoding transcoder.</li>
<li>Solution of the Euler problem.</li>
</ul>
<h2>Build system</h2>
<ul>
<li>It is now possible to configure whether documentation should be generated.</li>
<li>Documentation installation made more robust.</li>
</ul>
<h1>What now?</h1>
<p style="text-align:justify;">Well, as any Alpha version, this code needs testing, lots of testing. So please consider using it and posting both feedback, <a href="http://forge.ocamlcore.org/tracker/?atid=342&amp;group_id=17&amp;func=browse">requests for features</a> and <a href="http://forge.ocamlcore.org/tracker/?atid=151&amp;group_id=17&amp;func=browse">bug reports</a>.</p>
<p style="text-align:justify;">Besides testing and fixing bugs, our next few steps consist in</p>
<ul>
<li>improving the documentation and the on-line help</li>
<li>attempting to decrease the size of binaries produced with Batteries</li>
<li>integrating Delimited Overloading</li>
<li>integrating more network features (OCamlNet)</li>
<li>a preference system</li>
<li>improving configurability of the GODI package.</li>
</ul>
<p>And progressively moving towards 1.0!</p>
<p>The next release should be Beta 1 and is planned for March.</p>
<p>Have fun!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/276/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=276&subd=dutherenverseauborddelatable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2009/02/06/ocaml-batteries-included-alpha-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>Let&#8217;s do it with Batteries</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2009/01/27/lets-do-it-with-batteries/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2009/01/27/lets-do-it-with-batteries/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 20:15:03 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[OCaml]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[batteries included]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[caml]]></category>
		<category><![CDATA[camlp4]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[ml]]></category>
		<category><![CDATA[ocaml batteries included]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[programmation]]></category>
		<category><![CDATA[Programmation Fonctionnelle]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming languages]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[string manipulation]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=242</guid>
		<description><![CDATA[Or, OCaml is a scripting language, too.
Note: These extracts use the latest version of Batteries, currently available from the git. Barring any accident, this version should be made public within the next few days.
A few days ago, when writing some code for OCaml Batteries Included, I realized that, to properly embed Camomile&#8217;s Unicode transcoding module, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=242&subd=dutherenverseauborddelatable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h1 style="text-align:justify;">Or, OCaml is a scripting language, too.</h1>
<p style="text-align:justify;">Note: <em>These extracts use the latest version of Batteries, currently available from <a href="http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=batteries/batteries.git">the git</a>. Barring any accident, this version should be made public within the next few days.</em></p>
<p style="text-align:justify;">A few days ago, when writing some code for OCaml Batteries Included, I realized that, to properly embed Camomile&#8217;s Unicode transcoding module, I would need to manually write 500+ boring lines, all of them looking like:</p>
<pre name="code" class="php">

| `ascii -&gt; Encoding.of_name &quot;ASCII&quot;
</pre>
<p style="text-align:justify;">The idea behind that pattern matching was to define a type-safe phantom type for text encodings. Upon installation, Camomile generates a directory containing about 540 files, one per text encoding, and it seemed like a good idea to rely upon something less fragile than a string name.</p>
<p style="text-align:justify;">Of course, writing this pattern-matching manually was out of the question: it was boring, error-prone, and while Batteries deserves sacrifices, it doesn&#8217;t quite deserve that level of mind-numbing activities. The alternative was to generate both the list of constructors and the pattern-matching code from the contents of the directory. I could have done it with some scripting language but that sounded like a good chance to test-drive the numerous new functions of the String module of Batteries (73 for 28 in the Base Library).</p>
<h3 style="text-align:justify;">The main program</h3>
<p style="text-align:justify;">The structure of the program is easy: read the contents of a directory. For each file, do some treatment on the file name and print the result:</p>
<pre name="code" class="php">

open Shell
foreach (files_of argv.(1)) do_something
</pre>
<p style="text-align:justify;">Here, <code>foreach</code> is the same function as <code>iter</code> but with its arguments reversed. It&#8217;s sometimes much more readable. Instead of reading the contents of a directory with <code>Shell.files_of</code>, we could just as well have traversed the command-line arguments with <code>args</code>, or read the lines of standard input using <code>IO.lines_of stdin</code>.</p>
<p style="text-align:justify;">Actually, we could just as well generalize to a (possibly empty) set of directories. For this purpose, we just need to <code>map</code> our function <code>files_of</code> to the enumeration of command-line arguments. This yields an enumeration of enumerations, which we turn into a flat enumeration with <code>flatten</code>. In my mind, that&#8217;s somewhat nicer and more readable than nested loops.</p>
<p>Our main program now looks like:</p>
<pre name="code" class="php">

open Shell, Enum
foreach (flatten (map files_of (args ()))) do_something
</pre>
<p>Or, for those of us who prefer operators to parenthesis:</p>
<pre name="code" class="php">

open Shell, Enum
(foreach **&gt; flatten **&gt; map files_of **&gt; args ()) do_something
</pre>
<h3>String manipulation</h3>
<p>It&#8217;s now time to take a file name and turn it into</p>
<ol>
<li>a nice constructor name</li>
<li>a file name without extension,</li>
</ol>
<p style="text-align:justify;">That second point is the easiest, so let&#8217;s start with it. We have a function <code>Filename.chop_extension</code> just for this purpose. So, if we were interested only in printing the list of files without their extension, we could define</p>
<pre name="code" class="php">

let do_something x = print_endline (Filename.chop_extension x)
</pre>
<p>The first point is slightly trickier, as we need to</p>
<ol style="text-align:justify;">
<li>remove the extension from the file name (done)</li>
<li>prepend character <code>`</code> (trivial)</li>
<li>replace any illicit character with <code>_</code> (slightly more annoying, I know that the list of illicit characters which may actually appear in my list of files contains <code>:</code>, <code>-</code>, <code>(</code>, <code>)</code> and whitespaces but I&#8217;d rather not go and check manually  which other characters may turn out problematic)</li>
<li>prepend something before names which start with a digit, as digits cannot appear as the first character of an OCaml constructor (a tad annoying, too)</li>
<li>make everything lowercase, just because it&#8217;s nicer (trivial).</li>
</ol>
<p style="text-align:justify;">Let&#8217;s deal with the third item, it&#8217;s bound to be central. Let&#8217;s see, replacing characters could be done with regular expressions, something I dislike, or with function <code>String.map</code>. It&#8217;s nicer, type-safer, and it has a counterpart <code>Rope.map</code> for Unicode, if we ever need one. Now, functions <code>Char.is_letter</code> and <code>Char.is_digit</code> will help us determine which names are safe. Using them together, we obtain the following function:</p>
<pre name="code" class="php">

open Char
let replace s = String.map (fun c -&gt; if is_letter c || is_digit c then c else &#039;_&#039;) s
</pre>
<p>Let&#8217;s solve the fourth item on our list. We need to check the first character of a string and to determine whether it&#8217;s a digit. Well, we already know how to do this. Let&#8217;s call our prefix <code>p<code>:<br />
</code></code></p>
<pre name="code" class="php">

let clean_digit p s = if is_digit s.[0] then p^s else s
</pre>
<p>If we chain up everything, we obtain</p>
<pre name="code" class="php">

let constructor p s = &quot;`&quot; ^ (if is_digit r.[0] then p^r else r)
    where         r = lowercase (String.map (fun c -&gt; if is_letter c || is_digit c then c else &#039;_&#039;) s)
</pre>
<p>I like this <code>where</code> syntax.</p>
<h3>Format</h3>
<p style="text-align:justify;">Now that we have both our strings, we just need to be able to combine and print them. For this purpose, Printf is probably the most concise tool. Here, we can just write</p>
<pre name="code" class="php">

let print s1 s2 = Printf.printf &quot; | %s -&gt; %S\n&quot; s1 s2
</pre>
<p style="text-align:justify;">We could parameterize upon the format used by printf and we&#8217;re bound to do this sooner or later, but let&#8217;s keep it simple for now.</p>
<h3 style="text-align:justify;">The complete program</h3>
<pre name="code" class="php">

open Shell, Enum

foreach (flatten **&gt; map files_of **&gt; args ()) do_something
  where do_something s =
   let name = Filename.chop_extension s in Printf.printf &quot; | %s -&gt; %S\n&quot; c name
     where c = &quot;`&quot; ^ (if Char.is_digit r.[0] then &quot;codemap_&quot;^r else r)
     where r = lowercase (String.map (fun c -&gt; if Char.is_letter c || Char.is_digit c then c else &#039;_&#039;) name)
</pre>
<p style="text-align:justify;">I don&#8217;t know about you but I find this pretty nice, for a type-safe language. I&#8217;m sure it would have been possible to make something shorter in Perl or awk, and suggestions are welcome regarding how to improve this but I&#8217;m rather happy. And, once again, we&#8217;re not trying to beat Python, Perl or awk in concision, just to do something comparably good, because we already beat them by far in speed and safety.</p>
<p style="text-align:justify;">So, what do you think?</p>
<p style="text-align:justify;">
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/242/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=242&subd=dutherenverseauborddelatable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2009/01/27/lets-do-it-with-batteries/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>OCaml Batteries Included: The Hierarchy, reloaded</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2008/11/20/ocaml-batteries-included-the-hierarchy-reloaded/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2008/11/20/ocaml-batteries-included-the-hierarchy-reloaded/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 20:12:01 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[OCaml]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[batteries included]]></category>
		<category><![CDATA[feedback]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[modules]]></category>
		<category><![CDATA[ocaml batteries included]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming languages]]></category>
		<category><![CDATA[standard library]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=224</guid>
		<description><![CDATA[Well, my previous post on the Hierarchy of OCaml Batteries Included certainly triggered reactions. Essentially, judging from these, the OCaml community doesn&#8217;t seem to want of a module hierarchy. So here&#8217;s a reworked version of the library layout, without hierarchy. Again, feedback is appreciated and should go to the OCaml mailing-list.

Batteries

 Standard (automatically opened)
Legacy

 Arg
Array
…


Future

 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=224&subd=dutherenverseauborddelatable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">Well, my previous post on the Hierarchy of OCaml Batteries Included certainly triggered reactions. Essentially, judging from these, the OCaml community doesn&#8217;t seem to want of a module hierarchy. So here&#8217;s a reworked version of the library layout, without hierarchy. Again, feedback is appreciated and should go to the OCaml mailing-list.</p>
<p style="text-align:justify;">
<p style="text-align:justify;">Batteries</p>
<ol class="enumerate" style="text-align:justify;" type="1">
<li class="li-enumerate"> Standard (automatically opened)</li>
<li class="li-enumerate">Legacy
<ol class="enumerate" type="a">
<li class="li-enumerate"> Arg</li>
<li class="li-enumerate">Array</li>
<li class="li-enumerate">…</li>
</ol>
</li>
<li class="li-enumerate">Future
<ol class="enumerate" type="a">
<li class="li-enumerate"> Lexers
<ol class="enumerate" type="i">
<li class="li-enumerate"> C</li>
<li class="li-enumerate">OCaml</li>
</ol>
</li>
</ol>
<p><span style="font-size:large;"><strong>I. Control</strong></span></li>
<li class="li-enumerate">Exceptions</li>
<li class="li-enumerate">Return</li>
<li class="li-enumerate">Monad     <em>Interfaces for monadic operations</em>
<p><span style="font-size:medium;"><strong>I.1. Concurrency</strong></span></li>
<li class="li-enumerate">Concurrency     <em>Interfaces for concurrency operations</em>
<p><strong>I.1.i. Built-in threads</strong></li>
<li class="li-enumerate">Condition</li>
<li class="li-enumerate">Event</li>
<li class="li-enumerate">Mutex</li>
<li class="li-enumerate">RMutex</li>
<li class="li-enumerate">Thread</li>
<li class="li-enumerate">Threads     <em>A module containing aliases to </em><em><tt>Condition</tt></em><em>, </em><em><tt>Event</tt></em><em>&#8230;</em>
<p><strong>I.1.ii. coThreads</strong></li>
<li class="li-enumerate">CoCondition</li>
<li class="li-enumerate">CoEvent</li>
<li class="li-enumerate">CoMutex</li>
<li class="li-enumerate">CoRMutex</li>
<li class="li-enumerate">CoThread</li>
<li class="li-enumerate">CoThreads     <em>as </em><em><tt>Threads</tt></em><em> but with implementations coming from coThreads</em>
<p><strong>I.1.iii. Shared memory</strong></li>
<li class="li-enumerate">Shm_*     <em>Placeholders</em>
<p><span style="font-size:large;"><strong>II. IO</strong></span></li>
<li class="li-enumerate">IO
<ol class="enumerate" type="a">
<li class="li-enumerate">BigEndian</li>
</ol>
</li>
<li class="li-enumerate">GZip</li>
<li class="li-enumerate">Bz2</li>
<li class="li-enumerate">Zip</li>
<li class="li-enumerate">Transcode
<p><span style="font-size:large;"><strong>III. Mutable containers</strong></span></li>
<li class="li-enumerate">Array
<ol class="enumerate" type="a">
<li class="li-enumerate"> Cap
<ol class="enumerate" type="i">
<li class="li-enumerate"> ExceptionLess</li>
<li class="li-enumerate">Labels</li>
</ol>
</li>
<li class="li-enumerate">ExceptionLess</li>
<li class="li-enumerate">Labels</li>
</ol>
</li>
<li class="li-enumerate">Bigarray
<ol class="enumerate" type="a">
<li class="li-enumerate"> Array1</li>
<li class="li-enumerate">Array2</li>
<li class="li-enumerate">Array3</li>
</ol>
</li>
<li class="li-enumerate">Dllist</li>
<li class="li-enumerate">Dynarray</li>
<li class="li-enumerate">Enum
<ol class="enumerate" type="a">
<li class="li-enumerate"> ExceptionLess</li>
<li class="li-enumerate">Labels</li>
</ol>
</li>
<li class="li-enumerate">Global</li>
<li class="li-enumerate">Hashtbl
<ol class="enumerate" type="a">
<li class="li-enumerate"> Make
<ol class="enumerate" type="i">
<li class="li-enumerate"> ExceptionLess</li>
<li class="li-enumerate">Labels</li>
</ol>
</li>
</ol>
<p><span style="font-size:large;"><strong>IV. Persistent containers</strong></span></li>
<li class="li-enumerate">Lazy</li>
<li class="li-enumerate">List
<ol class="enumerate" type="a">
<li class="li-enumerate"> ExceptionLess</li>
<li class="li-enumerate">Labels</li>
</ol>
</li>
<li class="li-enumerate">Map
<ol class="enumerate" type="a">
<li class="li-enumerate"> Make
<ol class="enumerate" type="i">
<li class="li-enumerate"> ExceptionLess</li>
<li class="li-enumerate">Labels</li>
</ol>
</li>
</ol>
</li>
<li class="li-enumerate">Option
<ol class="enumerate" type="a">
<li class="li-enumerate"> Labels</li>
</ol>
</li>
<li class="li-enumerate">PMap</li>
<li class="li-enumerate">PSet</li>
<li class="li-enumerate">RefList
<ol class="enumerate" type="a">
<li class="li-enumerate"> Index</li>
</ol>
</li>
<li class="li-enumerate">Queue</li>
<li class="li-enumerate">Ref</li>
<li class="li-enumerate">Set
<ol class="enumerate" type="a">
<li class="li-enumerate"> Make
<ol class="enumerate" type="i">
<li class="li-enumerate"> ExceptionLess</li>
<li class="li-enumerate">Labels</li>
</ol>
</li>
</ol>
</li>
<li class="li-enumerate">Stack</li>
<li class="li-enumerate">Stream
<p><span style="font-size:large;"><strong>V. Data</strong></span></li>
<li class="li-enumerate">Unit
<p><span style="font-size:medium;"><strong>V.1. Logical</strong></span></li>
<li class="li-enumerate">Bool</li>
<li class="li-enumerate">BitSet
<p><span style="font-size:medium;"><strong>V.2. Numeric</strong></span></li>
<li class="li-enumerate">Numeric     <em>Interfaces for number-related stuff</em></li>
<li class="li-enumerate">Big_int</li>
<li class="li-enumerate">Common</li>
<li class="li-enumerate">Complex</li>
<li class="li-enumerate">Float</li>
<li class="li-enumerate">Int</li>
<li class="li-enumerate">Int32</li>
<li class="li-enumerate">Int64</li>
<li class="li-enumerate">Native_int</li>
<li class="li-enumerate">Num</li>
<li class="li-enumerate">Safe_float     <em>placeholder</em></li>
<li class="li-enumerate">Safe_int
<p><span style="font-size:medium;"><strong>V.3. Textual</strong></span></li>
<li class="li-enumerate">Text     <em>Definition of text-related interfaces</em></li>
<li class="li-enumerate">Buffer</li>
<li class="li-enumerate">Char</li>
<li class="li-enumerate">UTF8</li>
<li class="li-enumerate">Rope</li>
<li class="li-enumerate">UChar</li>
<li class="li-enumerate">String</li>
<li class="li-enumerate">StringText     <em>A module containing aliases to </em><em><tt>String</tt></em><em> and </em><em><tt>Char</tt></em><sup><a name="text1" href="#note1"><em>1</em></a></sup></li>
<li class="li-enumerate">RopeText     <em>As </em><em><tt>StringText</tt></em><em> but with implementations from </em><em><tt>Rope</tt></em><em> and </em><em><tt>UChar</tt></em></li>
<li class="li-enumerate">UTF8Text     <em>As </em><em><tt>StringText</tt></em><em> but with implementations from </em><em><tt>UTF8</tt></em><em> and </em><em><tt>UChar</tt></em>
<ol class="enumerate" type="a">
<li class="li-enumerate"> Labels</li>
</ol>
<p><span style="font-size:large;"><strong>VI. Distribution-related stuff</strong></span></li>
<li class="li-enumerate">Packages</li>
<li class="li-enumerate">Compilers
<p><span style="font-size:large;"><strong>VII. Internals</strong></span></li>
<li class="li-enumerate">Gc</li>
<li class="li-enumerate">Modules</li>
<li class="li-enumerate">Oo
<ol class="enumerate" type="a">
<li class="li-enumerate"> Private</li>
</ol>
</li>
<li class="li-enumerate">Weak
<ol class="enumerate" type="a">
<li class="li-enumerate"> Make</li>
</ol>
<p><span style="font-size:large;"><strong>VIII. Network (placeholders)</strong></span></li>
<li class="li-enumerate">URL</li>
<li class="li-enumerate">Netencoding
<ol class="enumerate" type="a">
<li class="li-enumerate"> Base64</li>
<li class="li-enumerate">QuotedPrintable</li>
<li class="li-enumerate">Q</li>
<li class="li-enumerate">URL</li>
<li class="li-enumerate">Html</li>
</ol>
<p><span style="font-size:medium;"><strong>VIII.1. Http</strong></span></li>
<li class="li-enumerate">Http</li>
<li class="li-enumerate">Http_client</li>
<li class="li-enumerate">Cgi_*</li>
<li class="li-enumerate">Httpd_*</li>
<li class="li-enumerate">MIME
<p><span style="font-size:medium;"><strong>VIII.2. Ftp</strong></span></li>
<li class="li-enumerate">Ftp_client
<p><span style="font-size:medium;"><strong>VIII.3. Mail</strong></span></li>
<li class="li-enumerate">Netmail</li>
<li class="li-enumerate">Pop</li>
<li class="li-enumerate">Sendmail</li>
<li class="li-enumerate">Smtp
<p><span style="font-size:medium;"><strong>VIII.4. Generic server</strong></span></li>
<li class="li-enumerate">Netplex_*
<p><span style="font-size:medium;"><strong>VIII.5. RPC</strong></span></li>
<li class="li-enumerate">Rpc_*
<p><span style="font-size:medium;"><strong>VIII.6. Languages</strong></span></li>
<li class="li-enumerate">Genlex</li>
<li class="li-enumerate">Lexing</li>
<li class="li-enumerate">CharParser</li>
<li class="li-enumerate">UCharParser</li>
<li class="li-enumerate">ParserCo
<ol class="enumerate" type="a">
<li class="li-enumerate"> Source</li>
</ol>
</li>
<li class="li-enumerate">Parsing</li>
<li class="li-enumerate">Format</li>
<li class="li-enumerate">Printf</li>
<li class="li-enumerate">Str</li>
<li class="li-enumerate">PCRE     <em>place-holder</em></li>
<li class="li-enumerate">Scanf
<ol class="enumerate" type="a">
<li class="li-enumerate"> Scanning</li>
</ol>
</li>
<li class="li-enumerate">SExpr
<p><span style="font-size:large;"><strong>IX. System</strong></span></li>
<li class="li-enumerate">Arg</li>
<li class="li-enumerate">File</li>
<li class="li-enumerate">OptParse
<ol class="enumerate" type="a">
<li class="li-enumerate"> Opt</li>
<li class="li-enumerate">OptParser</li>
<li class="li-enumerate">StdOpt</li>
</ol>
</li>
<li class="li-enumerate">Path</li>
<li class="li-enumerate">Shell</li>
<li class="li-enumerate">Unix
<ol class="enumerate" type="a">
<li class="li-enumerate"> Labels</li>
</ol>
</li>
<li class="li-enumerate">Equeue
<p><span style="font-size:large;"><strong>X. Unclassified</strong></span></li>
<li class="li-enumerate">Digest</li>
<li class="li-enumerate">Random
<ol class="enumerate" type="a">
<li class="li-enumerate"> State</li>
</ol>
</li>
<li class="li-enumerate">Date     <em>placeholder</em></li>
</ol>
<p style="text-align:justify;"><!--BEGIN NOTES document--></p>
<hr class="footnoterule" />
<p style="text-align:justify;">
<dl class="thefootnotes">
<dt class="dt-thefootnotes"> <a name="note1" href="#text1">1</a></dt>
<dd class="dd-thefootnotes">Actually a slightly modified version of <tt>Char</tt> to match signatures for Latin-1 and Unicode </dd>
</dl>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/224/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=224&subd=dutherenverseauborddelatable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2008/11/20/ocaml-batteries-included-the-hierarchy-reloaded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>Batteries: reworking the hierarchy (feedback wanted)</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2008/11/18/batteries-hierarchy/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2008/11/18/batteries-hierarchy/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 09:54:17 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[OCaml]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[batteries included]]></category>
		<category><![CDATA[caml]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[ml]]></category>
		<category><![CDATA[ocaml batteries included]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming languages]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=212</guid>
		<description><![CDATA[As readers interested in OCaml may know, we&#8217;ve been working for several months of OCaml Batteries Included. Early in the development, it appeared to us that, with the large number of modules involved, we would need a hierarchy of modules.
For instance, for the moment, we have a module System containing among other submodules IO (definition [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=212&subd=dutherenverseauborddelatable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">As readers interested in OCaml may know, we&#8217;ve been working for several months of OCaml Batteries Included. Early in the development, it appeared to us that, with the large number of modules involved, we would need a hierarchy of modules.</p>
<p>For instance, for the moment, we have a module <code>System</code> containing among other submodules <code>IO</code> (definition of i/o operations), <code>File</code> (definition of operations on files), <code>Sys</code> (the usual OCaml <code>Sys</code> module, soon to be expanded), etc.  Therefore, before one may open and manipulate files, one has to do</p>
<pre name="code" class="php">

open System.IO;;
open System.File;;
</pre>
<p>or, with the syntax extension we developed to alleviate this,</p>
<pre name="code" class="php">

open System, IO, File;;
</pre>
<p style="text-align:justify;">the syntax extension does a few other things which we&#8217;re not going to detail here &#8212; for one thing, it allows local opening of modules).</p>
<p style="text-align:justify;">Now that we&#8217;ve reached Alpha 2 and are well on our way towards Alpha 3, we&#8217;ve decided that it&#8217;s time to rework our current hierarchy and make it shorter and more consistent. Before we proceed, we&#8217;d like some feedback from the community. Discussion will take place mostly <a href="http://caml.inria.fr/pub/ml-archives/caml-list/2008/11/71eff104535573499d51d001265a2d38.en.html">on the OCaml mailing-list</a> and on irc (server: Freenode, channel: #ocaml) but I preferred posting the hierarchy here for easier reading.</p>
<p>At the moment, our hierarchy looks roughly as follows:</p>
<p>Batteries (automatically opened)</p>
<ol>
<li>Control
<ol>
<li>Concurrency
<ol>
<li>Common</li>
<li>Threads
<ol>
<li>Condition</li>
<li>Event</li>
<li>Mutex</li>
<li>Thread</li>
</ol>
</li>
</ol>
</li>
<li>Exceptions</li>
<li>Return</li>
<li>Monad</li>
</ol>
</li>
<li>Data
<ol>
<li>Containers (common interfaces)</li>
<li>Mutable
<ol>
<li>Array
<ol>
<li>Cap
<ol>
<li>Labels</li>
<li>ExceptionLess</li>
</ol>
</li>
<li>Labels</li>
<li>ExceptionLess</li>
</ol>
</li>
<li>Bigarray
<ol>
<li>Array1</li>
<li>Array2</li>
<li>Array3</li>
<li>Genarray</li>
</ol>
</li>
<li>Dllist</li>
<li>Dynarray</li>
<li>Enum
<ol>
<li>ExceptionLess</li>
</ol>
</li>
<li>Global</li>
<li>Hashtbl
<ol>
<li>Make
<ol>
<li>Labels</li>
<li>ExceptionLess</li>
</ol>
</li>
</ol>
</li>
<li>RefList
<ol>
<li>Index</li>
</ol>
</li>
<li>Queue</li>
<li>Ref</li>
<li>RefList</li>
<li>Stack</li>
<li>Stream</li>
</ol>
</li>
<li>Logical
<ol>
<li>Bool</li>
<li>BitSet</li>
</ol>
</li>
<li>Numeric
<ol>
<li>Big_int</li>
<li>Common</li>
<li>Complex</li>
<li>Float</li>
<li>Int</li>
<li>Int32</li>
<li>Int64</li>
<li>Native_int</li>
<li>Num</li>
<li>Safe_int</li>
<li>Unit</li>
<li>Common</li>
</ol>
</li>
<li>Persistent
<ol>
<li>Lazy</li>
<li>List
<ol>
<li>ExceptionLess</li>
<li>Labels</li>
</ol>
</li>
<li>Map
<ol>
<li>Make
<ol>
<li>ExceptionLess</li>
<li>Labels</li>
</ol>
</li>
</ol>
</li>
<li>Option
<ol>
<li>Labels</li>
</ol>
</li>
<li>PMap</li>
<li>PSet</li>
<li>Set
<ol>
<li>Make
<ol>
<li>ExceptionLess</li>
<li>Labels</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Text
<ol>
<li>Buffer</li>
<li>Char</li>
<li>UTF8</li>
<li>Rope</li>
<li>UChar</li>
<li>String
<ol>
<li>ExceptionLess</li>
<li>Labels</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Languages
<ol>
<li>CharParser</li>
<li>Genlex
<ol>
<li>Languages
<ol>
<li>Library
<ol>
<li>C</li>
<li>OCaml</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Format</li>
<li>Lexing</li>
<li>ParserCo
<ol>
<li>Source</li>
</ol>
</li>
<li>Parsing</li>
<li>Printf</li>
<li>Scanf
<ol>
<li>Scanning</li>
</ol>
</li>
<li>SExpr</li>
<li>Str</li>
</ol>
</li>
<li>Meta
<ol>
<li>Callback</li>
<li>CamlinternalMod</li>
<li>CamlinternalOo</li>
<li>Gc</li>
<li>Obj</li>
<li>Oo</li>
<li>Weak
<ol>
<li>Make</li>
</ol>
</li>
</ol>
</li>
<li>Standard (automatically opened)</li>
<li>System
<ol>
<li>Arg</li>
<li>Compress
<ol>
<li>GZip</li>
</ol>
</li>
<li>File</li>
<li>Filename</li>
<li>IO
<ol>
<li>BigEndian</li>
</ol>
</li>
<li>Network (placeholder)</li>
<li>OptParse
<ol>
<li>Opt</li>
<li>OptParser</li>
<li>StdOpt</li>
</ol>
</li>
<li>Unix
<ol>
<li>Labels</li>
</ol>
</li>
<li>Sys</li>
</ol>
</li>
<li>Toolchain
<ol>
<li>Execute</li>
<li>Findlib</li>
</ol>
</li>
<li>Util
<ol>
<li>Digest</li>
<li>Random
<ol>
<li>State</li>
</ol>
</li>
</ol>
</li>
<li>Legacy</li>
</ol>
<p>One possible replacement has been drafted:</p>
<ol>
<li>Control
<ol>
<li>Concurrency
<ol>
<li>Common</li>
<li>Threads
<ol>
<li>Condition</li>
<li>Event</li>
<li>Mutex</li>
<li>Thread</li>
</ol>
</li>
<li>Exceptions</li>
<li>Return</li>
<li>Monad</li>
</ol>
</li>
</ol>
</li>
<li>Data
<ol>
<li>Containers
<ol>
<li>Common</li>
<li>Array
<ol>
<li>Cap
<ol>
<li>ExceptionLess</li>
<li>Labels</li>
</ol>
</li>
<li>ExceptionLess</li>
<li>Labels</li>
</ol>
</li>
<li>Bigarray
<ol>
<li>Array1</li>
<li>Array2</li>
<li>Array3</li>
<li>Genarray</li>
</ol>
</li>
<li>Dllist</li>
<li>Dynarray</li>
<li>Enum
<ol>
<li>ExceptionLess</li>
<li>Labels</li>
</ol>
</li>
<li>Global</li>
<li>Hashtbl
<ol>
<li>Make
<ol>
<li>ExceptionLess</li>
<li>Labels</li>
</ol>
</li>
</ol>
</li>
<li>Lazy</li>
<li>List
<ol>
<li>ExceptionLess</li>
<li>Labels</li>
</ol>
</li>
<li>Map
<ol>
<li>Make</li>
</ol>
<ol>
<li>
<ol>
<li>ExceptionLess</li>
<li>Labels</li>
</ol>
</li>
</ol>
</li>
<li>Option
<ol>
<li>Labels</li>
</ol>
</li>
<li>PMap</li>
<li>PSet</li>
<li>RefList
<ol>
<li>Index</li>
</ol>
</li>
<li>Queue</li>
<li>Ref</li>
<li>RefList</li>
<li>Set</li>
<li>Make
<ol>
<li>ExceptionLess</li>
<li>Labels</li>
</ol>
</li>
<li>Stack</li>
<li>Stream</li>
</ol>
</li>
<li>Logical
<ol>
<li>Bool</li>
<li>BitSet</li>
<li>Unit</li>
</ol>
</li>
<li>Numeric
<ol>
<li>Interfaces (formerly Common)</li>
<li>Big_int</li>
<li>Common</li>
<li>Complex</li>
<li>Float</li>
<li>Int</li>
<li>Int32</li>
<li>Int64</li>
<li>Native_int</li>
<li>Num</li>
<li>Safe_int</li>
</ol>
</li>
<li>Text
<ol>
<li>Buffer</li>
<li>Char</li>
<li>UTF8</li>
<li>Rope</li>
<li>UChar</li>
<li>String
<ol>
<li>Labels</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Distro
<ol>
<li>Packages (formerly Findlib)</li>
<li>Tools (formerly Execute)</li>
</ol>
</li>
<li>Internals
<ol>
<li>Callback</li>
<li>Gc</li>
<li>Mod (formerly CamlinternalMod)</li>
<li>Obj</li>
<li>Oo
<ol>
<li>Private (formerly CamlinternalOo)</li>
</ol>
</li>
<li>Weak
<ol>
<li>Make</li>
</ol>
</li>
</ol>
</li>
<li>IO
<ol>
<li>BigEndian</li>
<li>Gzip</li>
<li>Bz2</li>
<li>Zip</li>
<li>Transcode (placeholder)</li>
</ol>
</li>
<li>Network (placeholder)</li>
<li>Text (formerly Languages)
<ol>
<li>Lex
<ol>
<li>Genlex
<ol>
<li>Languages
<ol>
<li>C</li>
<li>OCaml</li>
</ol>
</li>
</ol>
</li>
<li>Lexing</li>
</ol>
</li>
<li>Parse
<ol>
<li>CharParser</li>
<li>UCharParser</li>
<li>ParserCo
<ol>
<li>Source</li>
</ol>
</li>
<li>Parsing</li>
</ol>
</li>
<li>Pretty
<ol>
<li>Format</li>
</ol>
</li>
<li>Printf</li>
<li>Regexp
<ol>
<li>Str</li>
<li>PCRE (in the future)</li>
</ol>
</li>
<li>Scanf
<ol>
<li>Scanning</li>
</ol>
</li>
<li>SExpr</li>
<li>XML (placeholder)</li>
</ol>
</li>
<li>Standard (automatically opened)</li>
<li>Sys
<ol>
<li>Arg</li>
<li>File</li>
<li>OptParse
<ol>
<li>Opt</li>
<li>OptParser</li>
<li>StdOpt</li>
</ol>
</li>
<li>Path (formerly Filename)</li>
<li>Shell (formerly Sys)</li>
<li>Unix
<ol>
<li>Labels</li>
</ol>
</li>
</ol>
</li>
<li>Util
<ol>
<li>Digest</li>
<li>Random
<ol>
<li>State</li>
</ol>
</li>
</ol>
</li>
<li>Legacy</li>
</ol>
<p>The overall goal, with this new version, is to make for</p>
<ul>
<li>a shallower hierarchy</li>
<li>shorter module names</li>
<li>more consistent groups of modules.</li>
</ul>
<p>What do you think of this replacement? Is it any better?</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/212/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=212&subd=dutherenverseauborddelatable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2008/11/18/batteries-hierarchy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>OCaml Batteries Included: Alpha 2 has landed</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2008/11/10/ocaml-batteries-included-alpha-2-has-landed/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2008/11/10/ocaml-batteries-included-alpha-2-has-landed/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 20:20:44 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Enseignement]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[OCaml]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[batteries included]]></category>
		<category><![CDATA[cdk]]></category>
		<category><![CDATA[community ocaml]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[development kit]]></category>
		<category><![CDATA[foundation library]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[informatique]]></category>
		<category><![CDATA[lambda]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[ml]]></category>
		<category><![CDATA[multi-paradigm]]></category>
		<category><![CDATA[ocaml batteries included]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[sml]]></category>
		<category><![CDATA[stream]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=195</guid>
		<description><![CDATA[note: There seems to have been a WordPress bug. For some reason, the extended release notes on OCaml Batteries Included were replaced by something quite unrelated. My apologies for this.
Dear programmers, I am happy to inform you that the second alpha release of OCaml Batteries Included has landed. You may now download it from the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=195&subd=dutherenverseauborddelatable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;"><strong>note</strong>: There seems to have been a WordPress bug. For some reason, the extended release notes on OCaml Batteries Included were replaced by something quite unrelated. My apologies for this.</p>
<p style="text-align:justify;">Dear programmers, I am happy to inform you that the second alpha release of OCaml Batteries Included has landed. You may now download it <a href="http://forge.ocamlcore.org/frs/?group_id=17&amp;release_id=54" target="_blank">from the Forge</a>. A <a href="http://godi.camlcity.org/godi/toc/toc-3.10.html" target="_blank">GODI package</a> is also available and a Debian package should follow soon (you should be able to find the old one <a href="http://upsilon.cc/%7Ezack/blog/posts/2008/10/ocaml_batteries_included_debian_packages/" target="_blank">here</a>) and you can read the documentation <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha2/doc/batteries/html/" target="_blank">on-line</a>.</p>
<p style="text-align:justify;">So, what’s new in this release?</p>
<p style="text-align:justify;"><span id="more-195"></span></p>
<h3>Documentation</h3>
<ul style="text-align:justify;">
<li>All the quirks, bugs and erroneous links which plagued the documentation of Alpha 1 should now be gone.</li>
<li>Documentation has been extended, with more explanations regarding the use of Input/Output, more explanations on common functions of Pervasives, etc.</li>
<li>The top-level now has a <a href="../2008/11/06/ocaml-now-with-on-line-help/" target="_blank">on-line help feature</a>. You should try it, it’s nice.</li>
<li>New <a href="http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=batteries/batteries.git;a=tree;f=examples;h=9a9cadc3083f59e87630b13b790e9468fc3b6f06;hb=HEAD" target="_blank">examples</a>, including an <a href="http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=batteries/batteries.git;a=blob;f=examples/gzip.ml;h=d292b1db85235b932f985d1fdcb725c33432a055;hb=HEAD" target="_blank">8-liner gzip</a>.</li>
</ul>
<h3>Toolchain</h3>
<ul style="text-align:justify;">
<li>The top-level now works.</li>
<li>We now have a custom version of ocaml, ocamlc, ocamlopt and ocamlcp. To invoke them, use ocamlfind. For instance, for the new top-level, invoke <code>ocamlfind batteries/ocaml</code>. This should make your life simpler if you don’t use OCamlBuild.</li>
</ul>
<h3>Fundamentals</h3>
<ul style="text-align:justify;">
<li>Improved <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha2/doc/batteries/html/api/System.IO.html" target="_blank">Input/Output</a>. In particular, inputs and outputs may now be garbage-collected, automatically closed by higher-order functions, closed manually, closed by their dependencies, or closed automatically when program stops. Speed of key I/O operations was also largely improved.</li>
<li>We now have a set of <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha2/doc/batteries/html/api/Standard.html#6_Fundamentalfunctionsandoperators" target="_blank">standard combinators</a> for function composition. You won’t need anymore to redefine your |&gt;, &lt;|, etc.</li>
<li>Numerous improvements to Unicode, including improved type-safety, <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha2/doc/batteries/html/api/Data.Text.UChar.html" target="_blank">Unicode characters</a> on par with Latin-1 characters, etc.</li>
<li>We are now very close to being completely rid of legacy <code>channel_in</code> and <code>channel_out</code>, in favor of the more abstract, more composable, safer and more feature-rich IO. In particular, the <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha2/doc/batteries/html/api/System.Unix.html" target="_blank">Unix module</a> and the <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha2/doc/batteries/html/api/Standard.html" target="_blank">Standard</a> module are now completely rid of these pesky channels.</li>
</ul>
<h3>Utilities</h3>
<ul style="text-align:justify;">
<li>We now have transparent on-the-fly <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha2/doc/batteries/html/api/System.GZip.html" target="_blank">gzip compression/decompression</a> — more formats are coming.</li>
<li>A nice little <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha2/doc/batteries/html/api/Languages.ParserCo.html" target="_blank">parser combinator library</a> has been added. It works with either <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha2/doc/batteries/html/api/Languages.CharParser.html" target="_blank">Latin-1</a>, Unicode or custom tokens.</li>
<li>An OCaml program may now open a web browser to display a URI. In the future, this will be extended to opening arbitrary files with system-specific tools.</li>
<li>Appearance of a <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha2/doc/batteries/html/api/Standard.html#VALforeach"><code>foreach</code></a> loop (which is actually nothing more than <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha2/doc/batteries/html/api/Data.Mutable.Enum.html#VALiter"><code>Enum.iter</code></a>, but we don’t have to tell that to beginners).</li>
</ul>
<h3>Boilerplate</h3>
<ul>
<li>Most data structures now support serialization to/deserialization from S-Expressions.</li>
<li>Most data structures now support printing to arbitrary outputs.</li>
</ul>
<h2>What now?</h2>
<p style="text-align:justify;">Well, now, we’d appreciate if you could <a href="https://forge.ocamlcore.org/frs/?group_id=17&amp;release_id=54" target="_blank">download</a> and <a href="http://batteries.forge.ocamlcore.org/doc.preview/batteries-alpha2/doc/batteries/html/setup.html" target="_blank">install</a> this library. We’d appreciate if you could test your programs against it. And we’d appreciate if you could file <a href="http://forge.ocamlcore.org/tracker/?atid=151&amp;group_id=17&amp;func=browse" target="_blank">bug reports</a> and <a href="http://forge.ocamlcore.org/tracker/?atid=309&amp;group_id=17&amp;func=browse" target="_blank">request for features</a>.</p>
<h2 style="text-align:justify;">What’s next ?</h2>
<p style="text-align:justify;">We’re already at work on the next version.</p>
<p style="text-align:justify;">Here’s an overview of what you can expect in the relatively near future:</p>
<ul>
<li>Re-designed, simpler, module hierarchy (by the way, if you have suggestions, please drop us a line).</li>
<li>More syntax extensions, including the long-awaited finally.</li>
<li>Exception-less error management in addition to exceptions.</li>
<li>More on-the-fly (de)compression formats.</li>
<li>Further documentation.</li>
<li>Bindings for Camlp4.</li>
<li>Unicode transcoding I/O.</li>
<li>Further examples.</li>
<li>In-memory (de)compression.</li>
<li>File and directory management.</li>
<li>Shell programming.</li>
<li>Pattern-matching on lazy lists.</li>
<li>List (and other data structures) comprehension.</li>
<li>Compatibility with OCaml 3.11.</li>
</ul>
<p style="text-align:justify;">
<p style="text-align:justify;">
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/195/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/195/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/195/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/195/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/195/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/195/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/195/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/195/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/195/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/195/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=195&subd=dutherenverseauborddelatable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2008/11/10/ocaml-batteries-included-alpha-2-has-landed/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>A taste of OCaml Batteries Included</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2008/11/07/a-taste-of-ocaml-batteries-included/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2008/11/07/a-taste-of-ocaml-batteries-included/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 18:14:08 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Enseignement]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[OCaml]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[batteries included]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=191</guid>
		<description><![CDATA[I don&#8217;t know about you, but I have the feeling that many people are interested by OCaml Batteries Included but don&#8217;t dare try it yet, due to the Alpha status and the fact that it&#8217;s not available for their favorite Linux distribution yet. Well, it&#8217;s probably a healthy level of caution.
Of course, just reading the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=191&subd=dutherenverseauborddelatable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">I don&#8217;t know about you, but I have the feeling that many people are interested by OCaml Batteries Included but don&#8217;t dare try it yet, due to the Alpha status and the fact that it&#8217;s not available for their favorite Linux distribution yet. Well, it&#8217;s probably a healthy level of caution.</p>
<p style="text-align:justify;">Of course, just reading the manual is probably not the best way of getting a feeling of OCaml Batteries Included.</p>
<p style="text-align:justify;">So I&#8217;ve decided to take measures. From time to time, I&#8217;ll add here a few samples of what you can do with OCaml Batteries Included and how you can do it.</p>
<p style="text-align:justify;"><span id="more-191"></span>For today, let&#8217;s start with displaying the contents of a file. You know, Unix&#8217;s cat or MS-DOS&#8217;s type.</p>
<pre name="code" class="php">

open System, IO, File

iter (fun x -&gt; copy (open_in x) stdout) (args ())
</pre>
<p>That&#8217;s it. Three lines, one of them blank.</p>
<p style="text-align:justify;">Now, for details: <code>open System, IO, File</code> opens three modules <code>System</code> (which contains all system-related functions, including input/output, file management, etc.), <code>IO</code> (the submodule of <code>System</code> containing all the operations on inputs and outputs), and <code>File</code> (the submodule of <code>System</code> containing all the necessary to open files for reading, writing, etc.).</p>
<p style="text-align:justify;">Let&#8217;s move on to the last line. Function <code>iter</code> is defined in module <code>Standard</code>, which means that you don&#8217;t need to open any module to be able to use it. This function is a general imperative loop on enumerations. This is the equivalent of loop <code>for-each</code> in some languages. Perhaps I should detail what enumerations are: they are a read-and-forget data structure used pervasively in OCaml Batteries Included, and which replaces streams. By opposition to lists, arrays, etc., enumerations are built lazily and discarded as they are read, which makes them quite convenient for loops, or for accessing possibly huge sets of data &#8212; depending on your background, you may think of these either as streams (in OCaml and most languages) or as iterators (in Python, JavaScript and other dynamic languages). Oh, and for functional-minded people, don&#8217;t worry, your usual functional loops are available on enumerations, too. You can fold, map or unfold at will.</p>
<p style="text-align:justify;">So, what does <code>iter</code> do? Well, if asked, OCaml will tell you that it has type <code>('a -&gt; unit) -&gt; 'a Enum.t -&gt; unit</code>. In other words, for any type <code>'a</code>, this function takes as first argument a function (let&#8217;s call it <code>f</code>), as second argument an enumeration of elements of  type <code>'a</code> and returns nothing. Function <code>f</code> itself should take as argument an element of type <code>'a</code> and return nothing. In other words, <code>iter</code> takes a function which works on one element of type <code>'a</code> and turns it into a function which works on a whole enumeration of elements of type <code>'a</code>. Yep, it&#8217;s called a loop.</p>
<p style="text-align:justify;">Before looking at the definition of the function, let&#8217;s take a look at the enumeration passed to <code>iter</code>: <code>args ()</code>. Well, if we look at the documentation (for instance by using our on-line help), we may read</p>
<p style="text-align:justify;"><em>args(): An enumeration of the arguments passed to this program through the command line. </em></p>
<p style="text-align:justify;">So, <code>args ()</code> is your usual pair <code>argc</code> <img src='http://s.wordpress.com/wp-includes/images/smilies/face-smirk.png' alt=';,' class='wp-smiley' />  <code>argv</code> (if you come from C) or <code>args []</code> (if you come from Java). By opposition to Java, you don&#8217;t have to always put them in your program, if you don&#8217;t use them, and by opposition to both, it&#8217;s an enumeration, which makes more sense than an array, since you don&#8217;t need to modify them and since you always move forward among the arguments. Still, if you need it as an array, it&#8217;s available in a package. No more on this for the moment.</p>
<p style="text-align:justify;">What&#8217;s left? Oh, yes, the function. As the code indicates, <code>fun x -&gt; copy (open_in x) stdout)</code> is an anonymous function (also known as a &#8220;lambda&#8221; in a few languages). This function takes an argument <code>x</code>, the name of a file. Function <code>copy</code>, defined in module <code>IO</code>, takes two arguments, an <code>input</code> (a source of data) and an <code>output</code> (a sink of data), and copies the whole contents of the <code>input</code> into the <code>output</code>. The first argument here is <code>open_in x</code>, that is the result of applying function <code>open_in</code> to argument <code>x</code>. Function <code>open_in</code>, defined in module <code>File</code>, opens a file for reading. The result <code>open_in x</code> is therefore an <code>input</code> which lets us read the contents of file <code>x</code>. The second argument of <code>copy</code> is <code>stdout</code>, that is the standard output, that is the screen. In other words, <code>fun x -&gt; copy (open_in x) stdout)</code> is a function which takes as argument the name of a file, opens that file and prints its contents on the screen. Note that everything is done lazily, so the contents is never completely present in memory. In other words, this works on files of theoretically unlimited length.</p>
<p>
Bottom line: this utility reads all the files whose names are given on the command line and prints their content on the screen. In three lines of code.
</p>
<p>
Note that we could equally have written our utility </p>
<pre name="code" class="php">

open System, IO, File

iter f (args ()) where f x = copy (open_in x) stdout
</pre>
<p>or</p>
<pre name="code" class="php">

open System, IO, File

let f x = copy (open_in x) stdout;;
iter f (args ())
</pre>
<p>or, in one line,</p>
<pre name="code" class="php">

iter (fun x -&gt; System.IO.copy (System.File.open_in x) stdout) (args ())
</pre>
<p>or a number of other variants.</p>
<p>
Without Batteries Included, the same code, in OCaml, would have looked like</p>
<pre name="code" class="php">

for i = 1 to Array.length Sys.argv - 1 do
  let file = open_in Sys.args.(i) in
  let ended = ref false in
    while not !ended
      try print_endline (input_line file)
      with End_of_file -&gt; ended := true
    do
done
</pre>
<p>Not much longer but definitely more complicated. Oh, and for fun, here&#8217;s the Java version:</p>
<pre name="code" class="java">

import java.io.*;

public class Demo {
  public static final void main(String args[]) {
    try {
      for(String x : args) {
        BufferedReader reader = new BufferedReader(new FileReader(x));
        for(String read = reader.readLine();
                       read != null;
                       read = reader.readLine())
            System.out.println(read);
      }
    } catch (IOException e) {
    }
  }
}
</pre>
<p>Note quite as short, note quite as simple and, in my humble opinion, not quite as nice.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/191/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=191&subd=dutherenverseauborddelatable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2008/11/07/a-taste-of-ocaml-batteries-included/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>OCaml &#8212; now with on-line help</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2008/11/06/ocaml-now-with-on-line-help/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2008/11/06/ocaml-now-with-on-line-help/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 11:34:42 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Enseignement]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[OCaml]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[batteries included]]></category>
		<category><![CDATA[caml]]></category>
		<category><![CDATA[command-line]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[ocaml batteries included]]></category>
		<category><![CDATA[ocamldoc]]></category>
		<category><![CDATA[on-line help]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[teaching]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=189</guid>
		<description><![CDATA[I&#8217;m happy to tell you that the on-line help system for the OCaml toplevel has just been committed to our new  git repository.

So what does this mean?
Let&#8217;s take a look at a sample session:
$ rlwrap ocamlfind batteries/ocaml

        Objective Caml version 3.10.2

----------------------------------------------
&#124;        [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=189&subd=dutherenverseauborddelatable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">I&#8217;m happy to tell you that the on-line help system for the OCaml toplevel has just been committed to our new  <a href="http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=batteries/batteries.git">git repository</a>.</p>
<p style="text-align:justify;"><span id="more-189"></span></p>
<p style="text-align:justify;">So what does this mean?</p>
<p style="text-align:justify;">Let&#8217;s take a look at a sample session:</p>
<pre style="text-align:justify;">$ rlwrap ocamlfind batteries/ocaml

        Objective Caml version 3.10.2

----------------------------------------------
|                                            |
|     This is OCaml, Batteries Included.     |
|                                            |
|                                            |
|      If you need help, type '#help;;'      |
|                                            |
----------------------------------------------

        Camlp4 Parsing version 3.10.2</pre>
<p><em>We can type &#8220;<code>#help</code>&#8220;? Well, that&#8217;s new. Let&#8217;s type &#8220;<code>#help;;</code>&#8220;.</em></p>
<pre># #help;;
Welcome to OCaml, Batteries Included.

You are currently using the Toplevel of OCaml. You can think of it as
a powerful graphics calculator, or as a command-line comparable to
that of your operating system. It is also a nice way of learning OCaml
and of testing your algorithms and programs.

Notice character '#', at the start of some lines? That's called the
"prompt", it means that the Toplevel is waiting for your
orders.

Orders can take the form of value definitions, type definitions,
evaluations or directives. Value definitions let you teach OCaml new
tricks. Type definitions let you teach OCaml how to understand new
kinds of values informations and how to check that you're not making
mistakes when using your definitions. Evaluations let you actually do
something with your definitions, such as computing the result of your
algorithm, but also doing more complex things such as opening
applications, modifying files, or even creating websites. Any program
is composed of value definitions, type definitions and evaluations.

Finally, directives are not part of any program. They just let you
interact with the Toplevel, for instance by loading other programs,
reading the documentation, asking the Toplevel for information on
existing programs, etc. Directives are easy to spot, they also start
with character '#'. So, when you wrote "#help;;", that was a directive.

At this point, you may be interested in the following directives:
 #quit;;                   (*Use this to quit OCaml.            *)
 #use "some_file.ml";;     (*Use this to load another program.  *)
 #require "some_package";; (*Use this to load a library installed
                             on your computer.                  *)
 #help;;                   (*Well, you just used that one.      *)
 #man "some subject";;     (*Read the manual on some subject.   *)

Oh, don't forget: each order you give to the Toplevel should end with
";;".  That's how the Toplevel understands that you're done
writing. Otherwise, no matter how much you write, the Toplevel assumes
that you still intend to write more.

If you are new to programming, now is time to write
 #man "the tutorial";;

If you already know some other programming language, you should probably write
 #man "for programmers";;</pre>
<p><em>Let&#8217;s take a look at this tutorial.</em></p>
<pre># #man "the tutorial";;
Opening help on language construction "the tutorial" (OCaml Batteries Included)</pre>
<p><em>My web browser opens the tutorial at <a href="http://www.cs.jhu.edu/~scott/pl/lectures/caml-intro.html"><code>http://www.cs.jhu.edu/~scott/pl/lectures/caml-intro.html</code></a>.</em></p>
<pre># #man "print_endline";;
Opening help on value "print_endline" (OCaml Batteries Included)</pre>
<p><em>My web browser now displays the ocamldoc-generated help of <code>Pervasives.print_endline</code>.</em></p>
<pre># #man "input";;
Several definitions exist for "input".
This item exists as a method. For more information on "input" as a method, you may use
  #man_method "input";;

Item "input" also exists as a type. For more information on "input" as a type, you may use
  #man_type "input";;

Item "input" also exists as a value, with several possibilities. For more information on "input" as a value, you may use
  #man_value "Util.Digest.input";;
  #man_value "System.IO.input";;
  #man_value "Standard.input";;
  #man_value "Meta.Marshal.input";;</pre>
<p>etc.</p>
<p>Nice, isn&#8217;t it?<br />
We hope that this feature, together with the extended documentation provided with OCaml Batteries Included will prove useful for beginners and veterans alike.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/189/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&blog=1202429&post=189&subd=dutherenverseauborddelatable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2008/11/06/ocaml-now-with-on-line-help/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
	</channel>
</rss>