<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-14002</id>
	<title>Nabble - Ocaml Beginner</title>
	<updated>2009-12-07T01:43:39Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/Ocaml-Beginner-f14002.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Ocaml-Beginner-f14002.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26674828</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] understanding &quot;unbound type constructor&quot;</title>
	<published>2009-12-07T01:43:39Z</published>
	<updated>2009-12-07T01:43:39Z</updated>
	<author>
		<name>Martin DeMello</name>
	</author>
	<content type="html">On Mon, Dec 7, 2009 at 1:51 PM, Johannes Kanig &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26674828&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;johannes.kanig@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Martin DeMello wrote:
&lt;br&gt;&amp;gt; &amp;gt; I'm trying to get MLGame compiling against the latest OCaml and
&lt;br&gt;&amp;gt; &amp;gt; OCamlSDL.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Strange, i tried it and it compiles fine; I'm on a recent Ubuntu, I
&lt;br&gt;&amp;gt; installed ocaml and libsdl-ocaml-dev using the package system. MLGame
&lt;br&gt;&amp;gt; compiles fine. Maybe there is a problem with your installation of OcamlSDL?
&lt;/div&gt;&lt;br&gt;Ah, that's good to know! It's probably an environment issue, then (I'm
&lt;br&gt;using godi). I'll play with the makefile till it compiles.
&lt;br&gt;&lt;br&gt;martin
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---understanding-%22unbound-type-constructor%22-tp26660707p26674828.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26673994</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] understanding &quot;unbound type constructor&quot;</title>
	<published>2009-12-07T00:21:30Z</published>
	<updated>2009-12-07T00:21:30Z</updated>
	<author>
		<name>Johannes Kanig-2</name>
	</author>
	<content type="html">Martin DeMello wrote:
&lt;br&gt;&amp;gt; I'm trying to get MLGame compiling against the latest OCaml and
&lt;br&gt;&amp;gt; OCamlSDL. 
&lt;br&gt;&lt;br&gt;Strange, i tried it and it compiles fine; I'm on a recent Ubuntu, I
&lt;br&gt;installed ocaml and libsdl-ocaml-dev using the package system. MLGame
&lt;br&gt;compiles fine. Maybe there is a problem with your installation of OcamlSDL?
&lt;br&gt;&lt;br&gt;&amp;gt; What I don't get is, why does Sdlvideo.surface need a constructor for
&lt;br&gt;&amp;gt; that to compile?
&lt;br&gt;&lt;br&gt;It doesn't matter if the type corresponds to a type in C. The Ocaml
&lt;br&gt;compiler searches for an Ocaml type named Sdlvideo.surface, it doesn't
&lt;br&gt;find it on your system (for whatever reason), and it fails.
&lt;br&gt;&lt;br&gt;Johannes
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Johannes Kanig
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---understanding-%22unbound-type-constructor%22-tp26660707p26673994.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26673366</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] understanding &quot;unbound type constructor&quot;</title>
	<published>2009-12-06T23:13:54Z</published>
	<updated>2009-12-06T23:13:54Z</updated>
	<author>
		<name>Andreas Romeyke</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;Am Sonntag, den 06.12.2009, 05:21 +0530 schrieb Martin DeMello: &amp;nbsp;
&lt;br&gt;&amp;gt; I'm trying to get MLGame compiling against the latest OCaml and
&lt;br&gt;&amp;gt; OCamlSDL. make fails with
&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;br&gt;Does the compiler find the include-directory (Ocaml-directory)? Still
&lt;br&gt;exists the sdl-subdirectory there? (check with ocamlc -v, it should
&lt;br&gt;point to the base)
&lt;br&gt;&lt;br&gt;Bye Andreas
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Andreas Romeyke
&lt;br&gt;- Abteilung Blindenschrift -
&lt;br&gt;Deutsche Zentralbücherei für Blinde zu Leipzig (DZB)
&lt;br&gt;Gustav-Adolf-Straße 7, 04105 Leipzig
&lt;br&gt;Tel: +49 341 7113-..., Fax: +49 341 7113-125
&lt;br&gt;Internet: www.dzb.de
&lt;br&gt;E-Mail: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26673366&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;andreas.romeyke@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;[Non-text portions of this message have been removed]
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---understanding-%22unbound-type-constructor%22-tp26660707p26673366.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26667388</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] understanding &quot;unbound type constructor&quot;</title>
	<published>2009-12-06T10:10:05Z</published>
	<updated>2009-12-06T10:10:05Z</updated>
	<author>
		<name>Martin DeMello</name>
	</author>
	<content type="html">On Sun, Dec 6, 2009 at 10:15 PM, Richard Jones &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26667388&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rich@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Sun, Dec 06, 2009 at 05:21:31AM +0530, Martin DeMello wrote:
&lt;br&gt;&amp;gt; &amp;gt; Error: Unbound type constructor Sdlvideo.surface
&lt;br&gt;&amp;gt; [...]
&lt;br&gt;&amp;gt; &amp;gt; type t = {
&lt;br&gt;&amp;gt; &amp;gt; mutable surf : Sdlvideo.surface; (* &amp;lt;----- this is line 22 *)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; You mean, why does the compiler need to know the real type at that
&lt;br&gt;&amp;gt; point? Or do you mean 'constructor' in the sense of constructing
&lt;br&gt;&amp;gt; those types? I'm assuming it needs to know if it's an integral or a
&lt;br&gt;&amp;gt; boxed type, because that would change whether the compiler should
&lt;br&gt;&amp;gt; generate calls to update the remembered set when the mutable 'surf'
&lt;br&gt;&amp;gt; field changes.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; However I'm pretty sure in this case that the compiler is just looking
&lt;br&gt;&amp;gt; up the type and failing.
&lt;/div&gt;&lt;br&gt;Well, the type *exists* because the SDL code itself uses it all over
&lt;br&gt;the place. There's just the abstract &amp;quot;type surface&amp;quot; in sdlvideo.ml and
&lt;br&gt;I assume it's being mapped somewhere in sdlvideo_stub.c.
&lt;br&gt;&lt;br&gt;martin
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---understanding-%22unbound-type-constructor%22-tp26660707p26667388.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26666680</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] understanding &quot;unbound type constructor&quot;</title>
	<published>2009-12-06T08:45:42Z</published>
	<updated>2009-12-06T08:45:42Z</updated>
	<author>
		<name>Richard Jones-4</name>
	</author>
	<content type="html">On Sun, Dec 06, 2009 at 05:21:31AM +0530, Martin DeMello wrote:
&lt;br&gt;&amp;gt; Error: Unbound type constructor Sdlvideo.surface
&lt;br&gt;[...]
&lt;br&gt;&amp;gt; type t = {
&lt;br&gt;&amp;gt; &amp;nbsp; mutable surf : Sdlvideo.surface; (* &amp;lt;----- this is line 22 *)
&lt;br&gt;[...]
&lt;br&gt;&amp;gt; What I don't get is, why does Sdlvideo.surface need a constructor for
&lt;br&gt;&amp;gt; that to compile?
&lt;br&gt;&lt;br&gt;You mean, why does the compiler need to know the real type at that
&lt;br&gt;point? &amp;nbsp;Or do you mean 'constructor' in the sense of constructing
&lt;br&gt;those types? &amp;nbsp;I'm assuming it needs to know if it's an integral or a
&lt;br&gt;boxed type, because that would change whether the compiler should
&lt;br&gt;generate calls to update the remembered set when the mutable 'surf'
&lt;br&gt;field changes.
&lt;br&gt;&lt;br&gt;However I'm pretty sure in this case that the compiler is just looking
&lt;br&gt;up the type and failing.
&lt;br&gt;&lt;br&gt;The code is going to fail to compile one way or another if that type
&lt;br&gt;is no longer available in later versions of SDL, so best to fix the
&lt;br&gt;code.
&lt;br&gt;&lt;br&gt;Rich.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Richard Jones
&lt;br&gt;Red Hat
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---understanding-%22unbound-type-constructor%22-tp26660707p26666680.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26660707</id>
	<title>&quot;ocaml_beginners&quot;::[] understanding &quot;unbound type constructor&quot;</title>
	<published>2009-12-05T15:51:31Z</published>
	<updated>2009-12-05T15:51:31Z</updated>
	<author>
		<name>Martin DeMello</name>
	</author>
	<content type="html">I'm trying to get MLGame compiling against the latest OCaml and
&lt;br&gt;OCamlSDL. make fails with
&lt;br&gt;&lt;br&gt;---------------------------
&lt;br&gt;$ make
&lt;br&gt;Calculating dependencies of: MLG/video.mli
&lt;br&gt;Compiling: MLG/video.mli
&lt;br&gt;File &amp;quot;/home/martin/opt/MLG115/MLG/video.mli&amp;quot;, line 22, characters 17-33:
&lt;br&gt;Error: Unbound type constructor Sdlvideo.surface
&lt;br&gt;make: *** [out/MLG/video.cmi] Error 2
&lt;br&gt;---------------------------
&lt;br&gt;&lt;br&gt;and from video.mli:
&lt;br&gt;&lt;br&gt;---------------------------
&lt;br&gt;(** Low level video routines *)
&lt;br&gt;&lt;br&gt;(** TODO Type t is a type which represents an image for the actual
&lt;br&gt;&amp;nbsp; &amp;nbsp;mode or an. Atutomagically updated on videomode change. &amp;nbsp;*)
&lt;br&gt;type t = {
&lt;br&gt;&amp;nbsp; mutable surf : Sdlvideo.surface; (* &amp;lt;----- this is line 22 *)
&lt;br&gt;&amp;nbsp; mutable last_mode : int;
&lt;br&gt;&amp;nbsp; mutable provide : (unit -&amp;gt; Sdlvideo.surface);
&lt;br&gt;&amp;nbsp; mutable cam_pos : int * int;
&lt;br&gt;&amp;nbsp; mutable rect : Sdlvideo.rect;
&lt;br&gt;&amp;nbsp; mutable vmem : bool;
&lt;br&gt;};;
&lt;br&gt;---------------------------
&lt;br&gt;&lt;br&gt;What I don't get is, why does Sdlvideo.surface need a constructor for
&lt;br&gt;that to compile?
&lt;br&gt;&lt;br&gt;martin
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---understanding-%22unbound-type-constructor%22-tp26660707p26660707.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26654123</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Toplevel: loading Random</title>
	<published>2009-12-05T01:36:15Z</published>
	<updated>2009-12-05T01:36:15Z</updated>
	<author>
		<name>Hugo Ferreira</name>
	</author>
	<content type="html">Richard Jones wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Thu, Dec 03, 2009 at 10:37:00AM +0000, Hugo Ferreira wrote:
&lt;br&gt;&amp;gt;&amp;gt; I tried the example of loading the Num module as indicated
&lt;br&gt;&amp;gt;&amp;gt; in:
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.cocan.org/tips_for_using_the_ocaml_toplevel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cocan.org/tips_for_using_the_ocaml_toplevel&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Cannot seem to load the Random module.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; You don't need to load the Random module. &amp;nbsp;It's included in the
&lt;br&gt;&amp;gt; standard library which is always available:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; $ rlwrap ocaml
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Objective Caml version 3.11.1
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt; &amp;nbsp; # Random.int ;;
&lt;br&gt;&amp;gt; &amp;nbsp; - : int -&amp;gt; int = &amp;lt;fun&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Unless I'm misunderstanding what you're trying to do that is ...
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;You understood correctly. My mistake.
&lt;br&gt;My code snippet works.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;Hugo F.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; Rich.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Toplevel%3A-loading-Random-tp26623931p26654123.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26648173</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Toplevel: loading Random</title>
	<published>2009-12-04T11:46:44Z</published>
	<updated>2009-12-04T11:46:44Z</updated>
	<author>
		<name>Richard Jones-4</name>
	</author>
	<content type="html">On Thu, Dec 03, 2009 at 10:37:00AM +0000, Hugo Ferreira wrote:
&lt;br&gt;&amp;gt; I tried the example of loading the Num module as indicated
&lt;br&gt;&amp;gt; in:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.cocan.org/tips_for_using_the_ocaml_toplevel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cocan.org/tips_for_using_the_ocaml_toplevel&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Cannot seem to load the Random module.
&lt;br&gt;&lt;br&gt;You don't need to load the Random module. &amp;nbsp;It's included in the
&lt;br&gt;standard library which is always available:
&lt;br&gt;&lt;br&gt;&amp;nbsp; $ rlwrap ocaml
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Objective Caml version 3.11.1
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; # Random.int ;;
&lt;br&gt;&amp;nbsp; - : int -&amp;gt; int = &amp;lt;fun&amp;gt;
&lt;br&gt;&lt;br&gt;Unless I'm misunderstanding what you're trying to do that is ...
&lt;br&gt;&lt;br&gt;Rich.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Richard Jones
&lt;br&gt;Red Hat
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Toplevel%3A-loading-Random-tp26623931p26648173.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26624334</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Toplevel: loading Random</title>
	<published>2009-12-03T03:13:23Z</published>
	<updated>2009-12-03T03:13:23Z</updated>
	<author>
		<name>Hugo Ferreira</name>
	</author>
	<content type="html">To Martin and Mihamina,
&lt;br&gt;&lt;br&gt;Martin DeMello wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Thu, Dec 3, 2009 at 4:07 PM, Hugo Ferreira &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26624334&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hmf@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I tried the example of loading the Num module as indicated
&lt;br&gt;&amp;gt;&amp;gt; in:
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.cocan.org/tips_for_using_the_ocaml_toplevel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cocan.org/tips_for_using_the_ocaml_toplevel&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Cannot seem to load the Random module.
&lt;br&gt;&amp;gt;&amp;gt; What am I doing wrong?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Random seems to be available by default. Also, if you do #use
&lt;br&gt;&amp;gt; &amp;quot;topfind&amp;quot;;; #list;; there is no random listed.
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;Correct. Seem to have a problem elsewhere.
&lt;br&gt;&lt;br&gt;Thank you,
&lt;br&gt;Hugo F.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; martin
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ------------------------------------
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Archives up to December 31, 2008 are also downloadable at &lt;a href=&quot;http://www.connettivo.net/cntprojects/ocaml_beginners/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.connettivo.net/cntprojects/ocaml_beginners/&lt;/a&gt;&lt;br&gt;&amp;gt; The archives of the very official ocaml list (the seniors' one) can be found at &lt;a href=&quot;http://caml.inria.fr&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://caml.inria.fr&lt;/a&gt;&lt;br&gt;&amp;gt; Attachments are banned and you're asked to be polite, avoid flames etc.Yahoo! Groups Links
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Toplevel%3A-loading-Random-tp26623931p26624334.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26624184</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Toplevel: loading Random</title>
	<published>2009-12-03T03:01:06Z</published>
	<updated>2009-12-03T03:01:06Z</updated>
	<author>
		<name>Rakotomandimby Mihamina-3</name>
	</author>
	<content type="html">12/03/2009 01:37 PM, Hugo Ferreira::
&lt;br&gt;&amp;gt; # #use &amp;quot;topfind&amp;quot; ;;
&lt;br&gt;&lt;br&gt;#list;;
&lt;br&gt;&lt;br&gt;Will ist aavailable modules.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Architecte Informatique chez Blueline/Gulfsat:
&lt;br&gt;&amp;nbsp; &amp;nbsp; Administration Systeme, Recherche &amp; Developpement
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; +261 33 11 207 36
&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------
&lt;br&gt;&lt;br&gt;Archives up to December 31, 2008 are also downloadable at &lt;a href=&quot;http://www.connettivo.net/cntprojects/ocaml_beginners/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.connettivo.net/cntprojects/ocaml_beginners/&lt;/a&gt;&lt;br&gt;The archives of the very official ocaml list (the seniors' one) can be found at &lt;a href=&quot;http://caml.inria.fr&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://caml.inria.fr&lt;/a&gt;&lt;br&gt;Attachments are banned and you're asked to be polite, avoid flames etc.Yahoo! Groups Links
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To visit your group on the web, go to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://groups.yahoo.com/group/ocaml_beginners/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groups.yahoo.com/group/ocaml_beginners/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; Your email settings:
&lt;br&gt;&amp;nbsp; &amp;nbsp; Individual Email | Traditional
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To change settings online go to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://groups.yahoo.com/group/ocaml_beginners/join&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groups.yahoo.com/group/ocaml_beginners/join&lt;/a&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; (Yahoo! ID required)
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To change settings via email:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26624184&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners-digest@...&lt;/a&gt; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26624184&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners-fullfeatured@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To unsubscribe from this group, send an email to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26624184&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners-unsubscribe@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; Your use of Yahoo! Groups is subject to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://docs.yahoo.com/info/terms/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://docs.yahoo.com/info/terms/&lt;/a&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Toplevel%3A-loading-Random-tp26623931p26624184.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26624163</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Problem in Bigarray-Module underIntel64-Bit?</title>
	<published>2009-12-03T02:58:00Z</published>
	<updated>2009-12-03T02:58:00Z</updated>
	<author>
		<name>Andreas Romeyke</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;Am Mittwoch, den 02.12.2009, 16:53 +0000 schrieb Richard Jones:
&lt;br&gt;&lt;br&gt;&amp;gt; There's not much to go on. At the very least we'd want to see the
&lt;br&gt;&amp;gt; contents of registers when it segfaults. However it's not likely that
&lt;br&gt;&lt;br&gt;Hmm, ok.
&lt;br&gt;&lt;br&gt;&amp;gt; anyone can fix the problem unless you can write a small reproducer
&lt;br&gt;&amp;gt; program (and/or release your program's source code).
&lt;br&gt;&lt;br&gt;I will try to reduce the program as small as possible. 
&lt;br&gt;&lt;br&gt;There was an additional fact found, if we start the compiled program on
&lt;br&gt;a clean system (fresh booted linux), the program will be died as
&lt;br&gt;described.
&lt;br&gt;&lt;br&gt;But if you run the program twice, it will be run without segfaults.
&lt;br&gt;&lt;br&gt;Because the same effect does not occur on an AMD-32bit system (fresh
&lt;br&gt;compiled), it could have something to do with loading a library into the
&lt;br&gt;memory, I think.
&lt;br&gt;&lt;br&gt;The problem is hard to trigger down, I will sent more information as
&lt;br&gt;soon as possible.
&lt;br&gt;&lt;br&gt;Bye Andreas
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Andreas Romeyke
&lt;br&gt;- Abteilung Blindenschrift -
&lt;br&gt;Deutsche Zentralbücherei für Blinde zu Leipzig (DZB)
&lt;br&gt;Gustav-Adolf-Straße 7, 04105 Leipzig
&lt;br&gt;Tel: +49 341 7113-..., Fax: +49 341 7113-125
&lt;br&gt;Internet: www.dzb.de
&lt;br&gt;E-Mail: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26624163&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;andreas.romeyke@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;[Non-text portions of this message have been removed]
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Problem-in-Bigarray-Module-under-Intel64-Bit--tp26587983p26624163.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26624155</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Toplevel: loading Random</title>
	<published>2009-12-03T02:57:39Z</published>
	<updated>2009-12-03T02:57:39Z</updated>
	<author>
		<name>Martin DeMello</name>
	</author>
	<content type="html">On Thu, Dec 3, 2009 at 4:07 PM, Hugo Ferreira &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26624155&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hmf@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I tried the example of loading the Num module as indicated
&lt;br&gt;&amp;gt; in:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.cocan.org/tips_for_using_the_ocaml_toplevel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cocan.org/tips_for_using_the_ocaml_toplevel&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Cannot seem to load the Random module.
&lt;br&gt;&amp;gt; What am I doing wrong?
&lt;br&gt;&lt;br&gt;Random seems to be available by default. Also, if you do #use
&lt;br&gt;&amp;quot;topfind&amp;quot;;; #list;; there is no random listed.
&lt;br&gt;&lt;br&gt;martin
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Toplevel%3A-loading-Random-tp26623931p26624155.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26623931</id>
	<title>&quot;ocaml_beginners&quot;::[] Toplevel: loading Random</title>
	<published>2009-12-03T02:37:00Z</published>
	<updated>2009-12-03T02:37:00Z</updated>
	<author>
		<name>Hugo Ferreira</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;I tried the example of loading the Num module as indicated
&lt;br&gt;in:
&lt;br&gt;&lt;a href=&quot;http://www.cocan.org/tips_for_using_the_ocaml_toplevel&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cocan.org/tips_for_using_the_ocaml_toplevel&lt;/a&gt;&lt;br&gt;&lt;br&gt;Cannot seem to load the Random module.
&lt;br&gt;What am I doing wrong?
&lt;br&gt;&lt;br&gt;TIA,
&lt;br&gt;Hugo F.
&lt;br&gt;&lt;br&gt;&lt;br&gt;:~$ ocaml
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Objective Caml version 3.10.2
&lt;br&gt;&lt;br&gt;# #use &amp;quot;topfind&amp;quot; ;;
&lt;br&gt;- : unit = ()
&lt;br&gt;Findlib has been successfully loaded. Additional directives:
&lt;br&gt;&amp;nbsp; &amp;nbsp;#require &amp;quot;package&amp;quot;;; &amp;nbsp; &amp;nbsp; &amp;nbsp;to load a package
&lt;br&gt;&amp;nbsp; &amp;nbsp;#list;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; to list the available packages
&lt;br&gt;&amp;nbsp; &amp;nbsp;#camlp4o;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;to load camlp4 (standard syntax)
&lt;br&gt;&amp;nbsp; &amp;nbsp;#camlp4r;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;to load camlp4 (revised syntax)
&lt;br&gt;&amp;nbsp; &amp;nbsp;#predicates &amp;quot;p,q,...&amp;quot;;; &amp;nbsp; to set these predicates
&lt;br&gt;&amp;nbsp; &amp;nbsp;Topfind.reset();; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; to force that packages will be reloaded
&lt;br&gt;&amp;nbsp; &amp;nbsp;#thread;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; to enable threads
&lt;br&gt;&lt;br&gt;- : unit = ()
&lt;br&gt;# #require &amp;quot;random&amp;quot; ;;
&lt;br&gt;No such package: random
&lt;br&gt;# #require &amp;quot;num&amp;quot; ;;
&lt;br&gt;/home/hugof/ocaml/godi/lib/ocaml/std-lib/nums.cma: loaded
&lt;br&gt;/home/hugof/ocaml/godi/lib/ocaml/pkg-lib/num-top: added to search path
&lt;br&gt;/home/hugof/ocaml/godi/lib/ocaml/pkg-lib/num-top/num_top.cma: loaded
&lt;br&gt;/home/hugof/ocaml/godi/lib/ocaml/pkg-lib/num: added to search path
&lt;br&gt;&lt;br&gt;&lt;br&gt;------------------------------------
&lt;br&gt;&lt;br&gt;Archives up to December 31, 2008 are also downloadable at &lt;a href=&quot;http://www.connettivo.net/cntprojects/ocaml_beginners/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.connettivo.net/cntprojects/ocaml_beginners/&lt;/a&gt;&lt;br&gt;The archives of the very official ocaml list (the seniors' one) can be found at &lt;a href=&quot;http://caml.inria.fr&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://caml.inria.fr&lt;/a&gt;&lt;br&gt;Attachments are banned and you're asked to be polite, avoid flames etc.Yahoo! Groups Links
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To visit your group on the web, go to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://groups.yahoo.com/group/ocaml_beginners/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groups.yahoo.com/group/ocaml_beginners/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; Your email settings:
&lt;br&gt;&amp;nbsp; &amp;nbsp; Individual Email | Traditional
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To change settings online go to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://groups.yahoo.com/group/ocaml_beginners/join&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groups.yahoo.com/group/ocaml_beginners/join&lt;/a&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; (Yahoo! ID required)
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To change settings via email:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26623931&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners-digest@...&lt;/a&gt; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26623931&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners-fullfeatured@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To unsubscribe from this group, send an email to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26623931&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners-unsubscribe@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; Your use of Yahoo! Groups is subject to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://docs.yahoo.com/info/terms/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://docs.yahoo.com/info/terms/&lt;/a&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Toplevel%3A-loading-Random-tp26623931p26623931.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26612336</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Problem in Bigarray-Module under Intel64-Bit?</title>
	<published>2009-12-02T08:53:26Z</published>
	<updated>2009-12-02T08:53:26Z</updated>
	<author>
		<name>Richard Jones-4</name>
	</author>
	<content type="html">On Tue, Dec 01, 2009 at 09:06:35AM +0100, Romeyke, Andreas wrote:
&lt;br&gt;&amp;gt; my team mate is triggered in a possible bug by compiling an
&lt;br&gt;&amp;gt; ocaml-program under ocaml 11.1 using Bigarray-module.
&lt;br&gt;[...]
&lt;br&gt;&amp;gt; Do you have any hints to fix this problem or do you know a workaround?
&lt;br&gt;&amp;gt; Do you need additional information?
&lt;br&gt;&lt;br&gt;There's not much to go on. &amp;nbsp;At the very least we'd want to see the
&lt;br&gt;contents of registers when it segfaults. &amp;nbsp;However it's not likely that
&lt;br&gt;anyone can fix the problem unless you can write a small reproducer
&lt;br&gt;program (and/or release your program's source code).
&lt;br&gt;&lt;br&gt;Rich.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Richard Jones
&lt;br&gt;Red Hat
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Problem-in-Bigarray-Module-under-Intel64-Bit--tp26587983p26612336.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26611892</id>
	<title>&quot;ocaml_beginners&quot;::[] Re: Iterating over pairs within a list</title>
	<published>2009-12-02T08:30:48Z</published>
	<updated>2009-12-02T08:30:48Z</updated>
	<author>
		<name>Zheng Li-5</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;Just in case you might prefer fold:
&lt;br&gt;&lt;br&gt;----
&lt;br&gt;let any2 f l = List.fold_right (fun x r -&amp;gt; List.iter (f x) r; x::r) l []; ()
&lt;br&gt;----
&lt;br&gt;&lt;br&gt;Cheers
&lt;br&gt;Zheng
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26611892&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rixed@...&lt;/a&gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; &amp;nbsp;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Let's say I have a list, and want to code a function that calls a user 
&lt;br&gt;&amp;gt; function
&lt;br&gt;&amp;gt; for each possible pairs of distinct elements of the list, once.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Something like :
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; let iterpairs f l =
&lt;br&gt;&amp;gt; List.iter (fun a -&amp;gt; List.iter (fun b -&amp;gt; f a b) l) l
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; is not correct since f will be called for a = b and twice for any given 
&lt;br&gt;&amp;gt; a and b
&lt;br&gt;&amp;gt; (once with a and b and once later with b and a).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; What I wanted at first was a way to compare the addresses of the list cons
&lt;br&gt;&amp;gt; cells, so that I call only f with a and b such that a cell's address is 
&lt;br&gt;&amp;gt; lower
&lt;br&gt;&amp;gt; than b cell's address for instance. Or, since I couldn't find a way to reach
&lt;br&gt;&amp;gt; the cons cell from iter's callback, to do this using a and b addresses
&lt;br&gt;&amp;gt; (provided the list elements are boxed).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The problem is : f is likelly to do something that will trigger the GC which
&lt;br&gt;&amp;gt; can move things around, so the whole address comparison trick seams dubious.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Do you know of an other way to do that ?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; (Note: I want to do this for elements that are not meaningfully orderable).
&lt;br&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Iterating-over-pairs-within-a-list-tp26610233p26611892.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26611568</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Iterating over pairs within a list</title>
	<published>2009-12-02T08:13:35Z</published>
	<updated>2009-12-02T08:13:35Z</updated>
	<author>
		<name>rixed</name>
	</author>
	<content type="html">Wonderful solutions.
&lt;br&gt;&lt;br&gt;Thank you !
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Iterating-over-pairs-within-a-list-tp26610233p26611568.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26610946</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Iterating over pairs within a list</title>
	<published>2009-12-02T07:37:35Z</published>
	<updated>2009-12-02T07:37:35Z</updated>
	<author>
		<name>Martin Jambon</name>
	</author>
	<content type="html">&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26610946&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rixed@...&lt;/a&gt; wrote:
&lt;br&gt;&amp;gt; Let's say I have a list, and want to code a function that calls a user function
&lt;br&gt;&amp;gt; for each possible pairs of distinct elements of the list, once.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Here is my version:
&lt;br&gt;&lt;br&gt;let rec iter f = function
&lt;br&gt;&amp;nbsp; &amp;nbsp; [] -&amp;gt; ()
&lt;br&gt;&amp;nbsp; | x :: l -&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; List.iter (f x) l;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; iter f l
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;# iter (fun i j -&amp;gt; Printf.printf &amp;quot;(%i, %i)\n&amp;quot; i j) [ 1; 2; 3 ];;
&lt;br&gt;(1, 2)
&lt;br&gt;(1, 3)
&lt;br&gt;(2, 3)
&lt;br&gt;- : unit = ()
&lt;br&gt;&lt;br&gt;&lt;br&gt;Martin
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&lt;a href=&quot;http://mjambon.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mjambon.com/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Iterating-over-pairs-within-a-list-tp26610233p26610946.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26610795</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Iterating over pairs within a list</title>
	<published>2009-12-02T07:29:14Z</published>
	<updated>2009-12-02T07:29:14Z</updated>
	<author>
		<name>Eric Cooper</name>
	</author>
	<content type="html">On Wed, Dec 02, 2009 at 10:16:00AM -0500, Eric Cooper wrote:
&lt;br&gt;&amp;gt; let iterpairs f lst =
&lt;br&gt;&amp;gt; &amp;nbsp; List.iter
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; (fun x -&amp;gt; List.iter (fun y -&amp;gt; if x &amp;lt;&amp;gt; y then f x y) lst)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; lst
&lt;br&gt;&lt;br&gt;Sorry, that should be &amp;quot;&amp;lt;&amp;quot; (or &amp;quot;&amp;gt;&amp;quot;) rather than &amp;quot;&amp;lt;&amp;gt;&amp;quot;. &amp;nbsp;It's structural
&lt;br&gt;comparison, so GC triggered by f isn't a problem.
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Iterating-over-pairs-within-a-list-tp26610233p26610795.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26610674</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Iterating over pairs within a list</title>
	<published>2009-12-02T07:22:44Z</published>
	<updated>2009-12-02T07:22:44Z</updated>
	<author>
		<name>Hugo Ferreira</name>
	</author>
	<content type="html">&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26610674&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rixed@...&lt;/a&gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Let's say I have a list, and want to code a function that calls a user function
&lt;br&gt;&amp;gt; for each possible pairs of distinct elements of the list, once.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Something like :
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; let iterpairs f l =
&lt;br&gt;&amp;gt; 	List.iter (fun a -&amp;gt; List.iter (fun b -&amp;gt; f a b) l) l
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; is not correct since f will be called for a = b and twice for any given a and b
&lt;br&gt;&amp;gt; (once with a and b and once later with b and a).
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;$ ocaml
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Objective Caml version 3.10.2
&lt;br&gt;&lt;br&gt;# let f acc e1 e2 = (Printf.sprintf &amp;quot;(%d, %d)&amp;quot; e1 e2) :: acc
&lt;br&gt;&lt;br&gt;let fold_pairs f l =
&lt;br&gt;&amp;nbsp; &amp;nbsp;let rec loop l acc =
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;match l with
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;| h :: t -&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;let acc = List.fold_left (fun acc e -&amp;gt; f acc h e) acc t in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;loop t acc
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;| [] -&amp;gt; acc
&lt;br&gt;&amp;nbsp; &amp;nbsp;in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; loop l []
&lt;br&gt;&lt;br&gt;&lt;br&gt;let l = fold_pairs f [ 1 ; 2 ; 3 ] &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ;;
&lt;br&gt;val f : string list -&amp;gt; int -&amp;gt; int -&amp;gt; string list = &amp;lt;fun&amp;gt;
&lt;br&gt;val fold_pairs : ('a list -&amp;gt; 'b -&amp;gt; 'b -&amp;gt; 'a list) -&amp;gt; 'b list -&amp;gt; 'a list =
&lt;br&gt;&amp;nbsp; &amp;nbsp;&amp;lt;fun&amp;gt;
&lt;br&gt;val l : string list = [&amp;quot;(2, 3)&amp;quot;; &amp;quot;(1, 3)&amp;quot;; &amp;quot;(1, 2)&amp;quot;]
&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; What I wanted at first was a way to compare the addresses of the list cons
&lt;br&gt;&amp;gt; cells, so that I call only f with a and b such that a cell's address is lower
&lt;br&gt;&amp;gt; than b cell's address for instance. Or, since I couldn't find a way to reach
&lt;br&gt;&amp;gt; the cons cell from iter's callback, to do this using a and b addresses
&lt;br&gt;&amp;gt; (provided the list elements are boxed).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The problem is : f is likelly to do something that will trigger the GC which
&lt;br&gt;&amp;gt; can move things around, so the whole address comparison trick seams dubious.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Do you know of an other way to do that ?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; (Note: I want to do this for elements that are not meaningfully orderable).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ------------------------------------
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Archives up to December 31, 2008 are also downloadable at &lt;a href=&quot;http://www.connettivo.net/cntprojects/ocaml_beginners/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.connettivo.net/cntprojects/ocaml_beginners/&lt;/a&gt;&lt;br&gt;&amp;gt; The archives of the very official ocaml list (the seniors' one) can be found at &lt;a href=&quot;http://caml.inria.fr&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://caml.inria.fr&lt;/a&gt;&lt;br&gt;&amp;gt; Attachments are banned and you're asked to be polite, avoid flames etc.Yahoo! Groups Links
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Iterating-over-pairs-within-a-list-tp26610233p26610674.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26610646</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Iterating over pairs within a list</title>
	<published>2009-12-02T07:21:27Z</published>
	<updated>2009-12-02T07:21:27Z</updated>
	<author>
		<name>Martin DeMello</name>
	</author>
	<content type="html">let rec iterpairs f l =
&lt;br&gt;&amp;nbsp; match l with
&lt;br&gt;&amp;nbsp; | [] -&amp;gt; ();
&lt;br&gt;&amp;nbsp; | x :: xs -&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; begin
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List.iter (f x) xs;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iterpairs f xs
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;in
&lt;br&gt;let p x y = Printf.printf &amp;quot;(%d %d)&amp;quot; x y in
&lt;br&gt;iterpairs p [1; 2; 3; 4; 5]
&lt;br&gt;&lt;br&gt;martin
&lt;br&gt;&lt;br&gt;On Wed, Dec 2, 2009 at 8:26 PM, &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26610646&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rixed@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Let's say I have a list, and want to code a function that calls a user function
&lt;br&gt;&amp;gt; for each possible pairs of distinct elements of the list, once.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Something like :
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; let iterpairs f l =
&lt;br&gt;&amp;gt; List.iter (fun a -&amp;gt; List.iter (fun b -&amp;gt; f a b) l) l
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; is not correct since f will be called for a = b and twice for any given a and b
&lt;br&gt;&amp;gt; (once with a and b and once later with b and a).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What I wanted at first was a way to compare the addresses of the list cons
&lt;br&gt;&amp;gt; cells, so that I call only f with a and b such that a cell's address is lower
&lt;br&gt;&amp;gt; than b cell's address for instance. Or, since I couldn't find a way to reach
&lt;br&gt;&amp;gt; the cons cell from iter's callback, to do this using a and b addresses
&lt;br&gt;&amp;gt; (provided the list elements are boxed).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The problem is : f is likelly to do something that will trigger the GC which
&lt;br&gt;&amp;gt; can move things around, so the whole address comparison trick seams dubious.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Do you know of an other way to do that ?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; (Note: I want to do this for elements that are not meaningfully orderable).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;------------------------------------
&lt;br&gt;&lt;br&gt;Archives up to December 31, 2008 are also downloadable at &lt;a href=&quot;http://www.connettivo.net/cntprojects/ocaml_beginners/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.connettivo.net/cntprojects/ocaml_beginners/&lt;/a&gt;&lt;br&gt;The archives of the very official ocaml list (the seniors' one) can be found at &lt;a href=&quot;http://caml.inria.fr&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://caml.inria.fr&lt;/a&gt;&lt;br&gt;Attachments are banned and you're asked to be polite, avoid flames etc.Yahoo! Groups Links
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To visit your group on the web, go to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://groups.yahoo.com/group/ocaml_beginners/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groups.yahoo.com/group/ocaml_beginners/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; Your email settings:
&lt;br&gt;&amp;nbsp; &amp;nbsp; Individual Email | Traditional
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To change settings online go to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://groups.yahoo.com/group/ocaml_beginners/join&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groups.yahoo.com/group/ocaml_beginners/join&lt;/a&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; (Yahoo! ID required)
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To change settings via email:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26610646&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners-digest@...&lt;/a&gt; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26610646&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners-fullfeatured@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To unsubscribe from this group, send an email to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26610646&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners-unsubscribe@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; Your use of Yahoo! Groups is subject to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://docs.yahoo.com/info/terms/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://docs.yahoo.com/info/terms/&lt;/a&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Iterating-over-pairs-within-a-list-tp26610233p26610646.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26610563</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Iterating over pairs within a list</title>
	<published>2009-12-02T07:16:00Z</published>
	<updated>2009-12-02T07:16:00Z</updated>
	<author>
		<name>Eric Cooper</name>
	</author>
	<content type="html">On Wed, Dec 02, 2009 at 03:56:46PM +0100, &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26610563&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rixed@...&lt;/a&gt; wrote:
&lt;br&gt;&amp;gt; Let's say I have a list, and want to code a function that calls a
&lt;br&gt;&amp;gt; user function for each possible pairs of distinct elements of the
&lt;br&gt;&amp;gt; list, once.
&lt;br&gt;&lt;br&gt;let iterpairs f lst =
&lt;br&gt;&amp;nbsp; List.iter
&lt;br&gt;&amp;nbsp; &amp;nbsp; (fun x -&amp;gt; List.iter (fun y -&amp;gt; if x &amp;lt;&amp;gt; y then f x y) lst)
&lt;br&gt;&amp;nbsp; &amp;nbsp; lst
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Iterating-over-pairs-within-a-list-tp26610233p26610563.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26610233</id>
	<title>&quot;ocaml_beginners&quot;::[] Iterating over pairs within a list</title>
	<published>2009-12-02T06:56:46Z</published>
	<updated>2009-12-02T06:56:46Z</updated>
	<author>
		<name>rixed</name>
	</author>
	<content type="html">Let's say I have a list, and want to code a function that calls a user function
&lt;br&gt;for each possible pairs of distinct elements of the list, once.
&lt;br&gt;&lt;br&gt;Something like :
&lt;br&gt;&lt;br&gt;let iterpairs f l =
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List.iter (fun a -&amp;gt; List.iter (fun b -&amp;gt; f a b) l) l
&lt;br&gt;&lt;br&gt;is not correct since f will be called for a = b and twice for any given a and b
&lt;br&gt;(once with a and b and once later with b and a).
&lt;br&gt;&lt;br&gt;What I wanted at first was a way to compare the addresses of the list cons
&lt;br&gt;cells, so that I call only f with a and b such that a cell's address is lower
&lt;br&gt;than b cell's address for instance. Or, since I couldn't find a way to reach
&lt;br&gt;the cons cell from iter's callback, to do this using a and b addresses
&lt;br&gt;(provided the list elements are boxed).
&lt;br&gt;&lt;br&gt;The problem is : f is likelly to do something that will trigger the GC which
&lt;br&gt;can move things around, so the whole address comparison trick seams dubious.
&lt;br&gt;&lt;br&gt;Do you know of an other way to do that ?
&lt;br&gt;&lt;br&gt;(Note: I want to do this for elements that are not meaningfully orderable).
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Iterating-over-pairs-within-a-list-tp26610233p26610233.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26587983</id>
	<title>&quot;ocaml_beginners&quot;::[] Problem in Bigarray-Module under Intel64-Bit?</title>
	<published>2009-12-01T00:06:35Z</published>
	<updated>2009-12-01T00:06:35Z</updated>
	<author>
		<name>Andreas Romeyke</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;my team mate is triggered in a possible bug by compiling an
&lt;br&gt;ocaml-program under ocaml 11.1 using Bigarray-module.
&lt;br&gt;&lt;br&gt;The ocaml-package is self-compiled with configure with standard options,
&lt;br&gt;downloaded from &lt;a href=&quot;http://caml.inria.fr&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://caml.inria.fr&lt;/a&gt;&amp;nbsp;directly.
&lt;br&gt;&lt;br&gt;The program could be compiled and runs stable with ocaml 3.10.2 (debian)
&lt;br&gt;and 3.11.1 (selfcompiled) under AMD Sempron(tm) Processor LE-1150
&lt;br&gt;(32bit).
&lt;br&gt;&lt;br&gt;In both cases the same input files are used.
&lt;br&gt;&lt;br&gt;I have attached the output of &amp;quot;ocamlopt -v&amp;quot;, the output of
&lt;br&gt;Linux /proc/cpuinfo and the first lines of GDB backtrace.
&lt;br&gt;&lt;br&gt;The ocamlopt is called with this compile-options: '-g -pp
&lt;br&gt;&amp;quot;camlp4o&amp;quot;' (camlp4 is not really used, only used for better error
&lt;br&gt;reports)
&lt;br&gt;&lt;br&gt;Do you have any hints to fix this problem or do you know a workaround?
&lt;br&gt;Do you need additional information?
&lt;br&gt;&lt;br&gt;Bye Andreas
&lt;br&gt;&lt;br&gt;---- 8&amp;gt;&amp;lt; ---- 8&amp;gt;&amp;lt; ---- 8&amp;gt;&amp;lt; ---- 8&amp;gt;&amp;lt; ----
&lt;br&gt;ocamlopt -v
&lt;br&gt;The Objective Caml native-code compiler, version 3.11.1
&lt;br&gt;Standard library directory: /usr/local/lib/ocaml
&lt;br&gt;---- &amp;gt;&amp;lt;8 ---- &amp;gt;&amp;lt;8 ---- &amp;gt;&amp;lt;8 ---- &amp;gt;&amp;lt;8 ----
&lt;br&gt;&lt;br&gt;&lt;br&gt;---- 8&amp;gt;&amp;lt; ---- 8&amp;gt;&amp;lt; ---- 8&amp;gt;&amp;lt; ---- 8&amp;gt;&amp;lt; ----
&lt;br&gt;/proc/cpuinfo
&lt;br&gt;processor &amp;nbsp; &amp;nbsp; &amp;nbsp; : 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;vendor_id &amp;nbsp; &amp;nbsp; &amp;nbsp; : GenuineIntel &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;cpu family &amp;nbsp; &amp;nbsp; &amp;nbsp;: 6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;model &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 23 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;model name &amp;nbsp; &amp;nbsp; &amp;nbsp;: Intel(R) Core(TM)2 Duo CPU &amp;nbsp; &amp;nbsp; E8600 &amp;nbsp;@ 3.33GHz
&lt;br&gt;stepping &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;cpu MHz &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 2000.000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;cache size &amp;nbsp; &amp;nbsp; &amp;nbsp;: 6144 KB &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;physical id &amp;nbsp; &amp;nbsp; : 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;siblings &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;core id &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;cpu cores &amp;nbsp; &amp;nbsp; &amp;nbsp; : 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;apicid &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;initial apicid &amp;nbsp;: 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;fpu &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : yes
&lt;br&gt;fpu_exception &amp;nbsp; : yes
&lt;br&gt;cpuid level &amp;nbsp; &amp;nbsp; : 13
&lt;br&gt;wp &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: yes
&lt;br&gt;flags &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
&lt;br&gt;mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2ss ht tm pbe
&lt;br&gt;syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl pni
&lt;br&gt;monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr sse4_1 lahf_lm
&lt;br&gt;bogomips &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 6665.88
&lt;br&gt;clflush size &amp;nbsp; &amp;nbsp;: 64
&lt;br&gt;cache_alignment : 64
&lt;br&gt;address sizes &amp;nbsp; : 36 bits physical, 48 bits virtual
&lt;br&gt;power management:
&lt;br&gt;&lt;br&gt;processor &amp;nbsp; &amp;nbsp; &amp;nbsp; : 1
&lt;br&gt;vendor_id &amp;nbsp; &amp;nbsp; &amp;nbsp; : GenuineIntel
&lt;br&gt;cpu family &amp;nbsp; &amp;nbsp; &amp;nbsp;: 6
&lt;br&gt;model &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 23
&lt;br&gt;model name &amp;nbsp; &amp;nbsp; &amp;nbsp;: Intel(R) Core(TM)2 Duo CPU &amp;nbsp; &amp;nbsp; E8600 &amp;nbsp;@ 3.33GHz
&lt;br&gt;stepping &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 10
&lt;br&gt;cpu MHz &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 2000.000
&lt;br&gt;cache size &amp;nbsp; &amp;nbsp; &amp;nbsp;: 6144 KB
&lt;br&gt;physical id &amp;nbsp; &amp;nbsp; : 0
&lt;br&gt;siblings &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 2
&lt;br&gt;core id &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 1
&lt;br&gt;cpu cores &amp;nbsp; &amp;nbsp; &amp;nbsp; : 2
&lt;br&gt;apicid &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 1
&lt;br&gt;initial apicid &amp;nbsp;: 1
&lt;br&gt;fpu &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : yes
&lt;br&gt;fpu_exception &amp;nbsp; : yes
&lt;br&gt;cpuid level &amp;nbsp; &amp;nbsp; : 13
&lt;br&gt;wp &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: yes
&lt;br&gt;flags &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
&lt;br&gt;mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2ss ht tm pbe
&lt;br&gt;syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl pni
&lt;br&gt;monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr sse4_1 lahf_lm
&lt;br&gt;bogomips &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 6665.90
&lt;br&gt;clflush size &amp;nbsp; &amp;nbsp;: 64
&lt;br&gt;cache_alignment : 64
&lt;br&gt;address sizes &amp;nbsp; : 36 bits physical, 48 bits virtual
&lt;br&gt;power management:
&lt;br&gt;---- &amp;gt;&amp;lt;8 ---- &amp;gt;&amp;lt;8 ---- &amp;gt;&amp;lt;8 ---- &amp;gt;&amp;lt;8 ----
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;---- 8&amp;gt;&amp;lt; ---- 8&amp;gt;&amp;lt; ---- 8&amp;gt;&amp;lt; ---- 8&amp;gt;&amp;lt; ---- 
&lt;br&gt;Program received signal SIGSEGV, Segmentation
&lt;br&gt;fault. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;0x0000000000443fb2 in caml_ba_get_N
&lt;br&gt;() &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;Current language: &amp;nbsp;auto; currently
&lt;br&gt;asm &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;(gdb)
&lt;br&gt;bt &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;br&gt;#0 &amp;nbsp;0x0000000000443fb2 in caml_ba_get_N ()
&lt;br&gt;#1 &amp;nbsp;0x0000000000444113 in caml_ba_get_2 ()
&lt;br&gt;#2 &amp;nbsp;0x0000000000454e00 in caml_c_call ()
&lt;br&gt;#3 &amp;nbsp;0x00007ffff7fd3fb8 in ?? ()
&lt;br&gt;#4 &amp;nbsp;0x000000000041419a in camlSpeedseg__flood_368 ()
&lt;br&gt;#5 &amp;nbsp;0x0000000000000141 in ?? ()
&lt;br&gt;#6 &amp;nbsp;0x000000000000013f in ?? ()
&lt;br&gt;#7 &amp;nbsp;0x0000000000000689 in ?? ()
&lt;br&gt;#8 &amp;nbsp;0x00007ffff7fd3ea8 in ?? ()
&lt;br&gt;#9 &amp;nbsp;0x0000000000000009 in ?? ()
&lt;br&gt;#10 0x0000000000414237 in camlSpeedseg__flood_368 ()
&lt;br&gt;#11 0x0000000000000001 in ?? ()
&lt;br&gt;#12 0x0000000000000141 in ?? ()
&lt;br&gt;#13 0x0000000000000689 in ?? ()
&lt;br&gt;#14 0x00007ffff7fd3ea8 in ?? ()
&lt;br&gt;#15 0x0000000000000009 in ?? ()
&lt;br&gt;#16 0x000000000041424f in camlSpeedseg__flood_368 ()
&lt;br&gt;#17 0x0000000000000001 in ?? ()
&lt;br&gt;#18 0x000000000000013f in ?? ()
&lt;br&gt;#19 0x0000000000000689 in ?? ()
&lt;br&gt;#20 0x00007ffff7fd3ea8 in ?? ()
&lt;br&gt;#21 0x0000000000000009 in ?? ()
&lt;br&gt;#22 0x000000000041424f in camlSpeedseg__flood_368 ()
&lt;br&gt;#23 0x0000000000000001 in ?? ()
&lt;br&gt;#24 0x000000000000013d in ?? ()
&lt;br&gt;#25 0x0000000000000689 in ?? ()
&lt;br&gt;#26 0x00007ffff7fd3ea8 in ?? ()
&lt;br&gt;#27 0x0000000000000009 in ?? ()
&lt;br&gt;#28 0x000000000041424f in camlSpeedseg__flood_368 ()
&lt;br&gt;#29 0x0000000000000001 in ?? ()
&lt;br&gt;#30 0x000000000000013b in ?? ()
&lt;br&gt;#31 0x0000000000000689 in ?? ()
&lt;br&gt;#32 0x00007ffff7fd3ea8 in ?? ()
&lt;br&gt;#33 0x0000000000000009 in ?? ()
&lt;br&gt;#34 0x000000000041424f in camlSpeedseg__flood_368 ()
&lt;br&gt;#35 0x0000000000000001 in ?? ()
&lt;br&gt;#36 0x0000000000000139 in ?? ()
&lt;br&gt;#37 0x0000000000000689 in ?? ()
&lt;br&gt;#38 0x00007ffff7fd3ea8 in ?? ()
&lt;br&gt;#39 0x0000000000000009 in ?? ()
&lt;br&gt;---- &amp;gt;&amp;lt;8 ---- &amp;gt;&amp;lt;8 ---- &amp;gt;&amp;lt;8 ---- &amp;gt;&amp;lt;8 ----
&lt;br&gt;-- 
&lt;br&gt;Andreas Romeyke
&lt;br&gt;- Abteilung Blindenschrift -
&lt;br&gt;Deutsche Zentralbücherei für Blinde zu Leipzig (DZB)
&lt;br&gt;Gustav-Adolf-Straße 7, 04105 Leipzig
&lt;br&gt;Tel: +49 341 7113-..., Fax: +49 341 7113-125
&lt;br&gt;Internet: www.dzb.de
&lt;br&gt;E-Mail: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26587983&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;andreas.romeyke@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;[Non-text portions of this message have been removed]
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Problem-in-Bigarray-Module-under-Intel64-Bit--tp26587983p26587983.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26573835</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Creating Library</title>
	<published>2009-11-30T04:22:08Z</published>
	<updated>2009-11-30T04:22:08Z</updated>
	<author>
		<name>Richard Jones-4</name>
	</author>
	<content type="html">On Mon, Nov 30, 2009 at 12:01:37PM +0100, Romeyke, Andreas wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; My project has different Modules and compilation and linking works well.
&lt;br&gt;&amp;gt; Now I want to split a module &amp;quot;experts.ml&amp;quot; into many different
&lt;br&gt;&amp;gt; module-parts under directory &amp;quot;experts/&amp;quot;:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; experts/expert_isunknown.ml
&lt;br&gt;&amp;gt; experts/expert_ispage.ml
&lt;br&gt;&amp;gt; experts/expert_isnum.ml
&lt;br&gt;&amp;gt; ...
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; But the other modules (foo.ml) tries to open the original &amp;quot;experts.ml&amp;quot;,
&lt;br&gt;&amp;gt; which should be replaced by a library of the new expert-module-parts.
&lt;/div&gt;[...]
&lt;br&gt;&amp;gt; How to do this correctly?
&lt;br&gt;&lt;br&gt;If you really want to do this I think your best bet is to use the C
&lt;br&gt;preprocessor:
&lt;br&gt;&lt;br&gt;&amp;nbsp; ocamlc -pp cpp [...]
&lt;br&gt;&lt;br&gt;and then use #include directives as necessary.
&lt;br&gt;&lt;br&gt;In general (except for the case of -for-pack / -pack) it's better to
&lt;br&gt;use one source file per module. &amp;nbsp;If the source file is too big, use a
&lt;br&gt;folding editor to manage it:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &lt;a href=&quot;http://en.wikipedia.org/wiki/Code_folding&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/Code_folding&lt;/a&gt;&lt;br&gt;&lt;br&gt;Rich.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Richard Jones
&lt;br&gt;Red Hat
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Creating-Library-tp26572801p26573835.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26573658</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Creating Library</title>
	<published>2009-11-30T03:53:15Z</published>
	<updated>2009-11-30T03:53:15Z</updated>
	<author>
		<name>Hugo Ferreira</name>
	</author>
	<content type="html">Romeyke, Andreas wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Am Montag, den 30.11.2009, 11:32 +0000 schrieb Hugo Ferreira:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; I don't know how to create libraries but note that whenever
&lt;br&gt;&amp;gt;&amp;gt; you create a file you are in effect creating a module with the
&lt;br&gt;&amp;gt;&amp;gt; name of that file (capitalize first letter). So all of the
&lt;br&gt;&amp;gt;&amp;gt; of the functions in say &amp;quot;experts/expert_isunknown.ml&amp;quot; should
&lt;br&gt;&amp;gt;&amp;gt; be invoked with &amp;quot;Expert_isunknown.&amp;quot; preceding the function name
&lt;br&gt;&amp;gt;&amp;gt; or alternatively with &amp;quot;open Expert_isunknown&amp;quot;.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; That I am already know.
&lt;br&gt;&amp;gt;&amp;gt; That being said you can try to :
&lt;br&gt;&amp;gt;&amp;gt; a) Create a Expert module that _includes_ all others
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I would avoid this to allow independent development of expert-modules
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; b) Pack those modules via compilation into a single one
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I already compiled alle experts/expert_*.ml into one expert.cmxa using
&lt;br&gt;&amp;gt; interface-file experts.mli
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;Their is a compilation option that does this [see 1 section 11.2 ]. As I
&lt;br&gt;said I don't know how this works but maybe someone more knowledgeable
&lt;br&gt;can help.
&lt;br&gt;&lt;br&gt;R,
&lt;br&gt;Hugo F.
&lt;br&gt;&lt;br&gt;[1] &lt;a href=&quot;http://caml.inria.fr/pub/docs/manual-ocaml/manual025.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://caml.inria.fr/pub/docs/manual-ocaml/manual025.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; But how can I avoid to use something like
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;quot;open Expert_isunknown&amp;quot;
&lt;br&gt;&amp;gt; &amp;quot;open Expert_ispage&amp;quot;
&lt;br&gt;&amp;gt; ...
&lt;br&gt;&amp;gt; and so on
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; in my foo.ml file? Or in other words, if experts.cmxa is my library and
&lt;br&gt;&amp;gt; experts.mli is my interface, what I need to do compiling foo.ml right?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Bye Andreas
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Creating-Library-tp26572801p26573658.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26573316</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Creating Library</title>
	<published>2009-11-30T03:40:58Z</published>
	<updated>2009-11-30T03:40:58Z</updated>
	<author>
		<name>Andreas Romeyke</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;Am Montag, den 30.11.2009, 11:32 +0000 schrieb Hugo Ferreira:
&lt;br&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I don't know how to create libraries but note that whenever
&lt;br&gt;&amp;gt; you create a file you are in effect creating a module with the
&lt;br&gt;&amp;gt; name of that file (capitalize first letter). So all of the
&lt;br&gt;&amp;gt; of the functions in say &amp;quot;experts/expert_isunknown.ml&amp;quot; should
&lt;br&gt;&amp;gt; be invoked with &amp;quot;Expert_isunknown.&amp;quot; preceding the function name
&lt;br&gt;&amp;gt; or alternatively with &amp;quot;open Expert_isunknown&amp;quot;.
&lt;br&gt;&lt;br&gt;That I am already know.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; That being said you can try to :
&lt;br&gt;&amp;gt; a) Create a Expert module that _includes_ all others
&lt;br&gt;&lt;br&gt;I would avoid this to allow independent development of expert-modules
&lt;br&gt;&lt;br&gt;&amp;gt; b) Pack those modules via compilation into a single one
&lt;br&gt;&lt;br&gt;I already compiled alle experts/expert_*.ml into one expert.cmxa using
&lt;br&gt;interface-file experts.mli
&lt;br&gt;&lt;br&gt;But how can I avoid to use something like
&lt;br&gt;&lt;br&gt;&amp;quot;open Expert_isunknown&amp;quot;
&lt;br&gt;&amp;quot;open Expert_ispage&amp;quot;
&lt;br&gt;...
&lt;br&gt;and so on
&lt;br&gt;&lt;br&gt;in my foo.ml file? Or in other words, if experts.cmxa is my library and
&lt;br&gt;experts.mli is my interface, what I need to do compiling foo.ml right?
&lt;br&gt;&lt;br&gt;Bye Andreas
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Andreas Romeyke
&lt;br&gt;- Abteilung Blindenschrift -
&lt;br&gt;Deutsche Zentralbücherei für Blinde zu Leipzig (DZB)
&lt;br&gt;Gustav-Adolf-Straße 7, 04105 Leipzig
&lt;br&gt;Tel: +49 341 7113-..., Fax: +49 341 7113-125
&lt;br&gt;Internet: www.dzb.de
&lt;br&gt;E-Mail: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26573316&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;andreas.romeyke@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;[Non-text portions of this message have been removed]
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Creating-Library-tp26572801p26573316.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26573240</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Creating Library</title>
	<published>2009-11-30T03:32:40Z</published>
	<updated>2009-11-30T03:32:40Z</updated>
	<author>
		<name>Hugo Ferreira</name>
	</author>
	<content type="html">Hi Andreas,
&lt;br&gt;&lt;br&gt;Romeyke, Andreas wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; My project has different Modules and compilation and linking works well.
&lt;br&gt;&amp;gt; Now I want to split a module &amp;quot;experts.ml&amp;quot; into many different
&lt;br&gt;&amp;gt; module-parts under directory &amp;quot;experts/&amp;quot;:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; experts/expert_isunknown.ml
&lt;br&gt;&amp;gt; experts/expert_ispage.ml
&lt;br&gt;&amp;gt; experts/expert_isnum.ml
&lt;br&gt;&amp;gt; ...
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; But the other modules (foo.ml) tries to open the original &amp;quot;experts.ml&amp;quot;,
&lt;br&gt;&amp;gt; which should be replaced by a library of the new expert-module-parts.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; First I have defined a new experts.mli file, the file &amp;quot;experts.cmxa&amp;quot; is
&lt;br&gt;&amp;gt; built correctly with 
&lt;br&gt;&amp;gt; &amp;nbsp;ocamlopt -a -o experts.cmxa expert_isunknown.ml expert_ispage.ml ...
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; but ocaml now triggers following error by compiling foo.ml with
&lt;br&gt;&amp;gt; experts.cmxa:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Unbound module Experts
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; How to do this correctly?
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;I don't know how to create libraries but note that whenever
&lt;br&gt;you create a file you are in effect creating a module with the
&lt;br&gt;name of that file (capitalize first letter). So all of the
&lt;br&gt;of the functions in say &amp;quot;experts/expert_isunknown.ml&amp;quot; should
&lt;br&gt;be invoked with &amp;quot;Expert_isunknown.&amp;quot; preceding the function name
&lt;br&gt;or alternatively with &amp;quot;open Expert_isunknown&amp;quot;.
&lt;br&gt;&lt;br&gt;That being said you can try to :
&lt;br&gt;a) Create a Expert module that _includes_ all others
&lt;br&gt;b) Pack those modules via compilation into a single one
&lt;br&gt;&lt;br&gt;Maybe as a beginner solution (a) may be easiest.
&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;Hugo F.
&lt;br&gt;&lt;br&gt;&amp;gt; Bye Andreas
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Creating-Library-tp26572801p26573240.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26572801</id>
	<title>&quot;ocaml_beginners&quot;::[] Creating Library</title>
	<published>2009-11-30T03:01:37Z</published>
	<updated>2009-11-30T03:01:37Z</updated>
	<author>
		<name>Andreas Romeyke</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;My project has different Modules and compilation and linking works well.
&lt;br&gt;Now I want to split a module &amp;quot;experts.ml&amp;quot; into many different
&lt;br&gt;module-parts under directory &amp;quot;experts/&amp;quot;:
&lt;br&gt;&lt;br&gt;experts/expert_isunknown.ml
&lt;br&gt;experts/expert_ispage.ml
&lt;br&gt;experts/expert_isnum.ml
&lt;br&gt;...
&lt;br&gt;&lt;br&gt;But the other modules (foo.ml) tries to open the original &amp;quot;experts.ml&amp;quot;,
&lt;br&gt;which should be replaced by a library of the new expert-module-parts.
&lt;br&gt;&lt;br&gt;First I have defined a new experts.mli file, the file &amp;quot;experts.cmxa&amp;quot; is
&lt;br&gt;built correctly with 
&lt;br&gt;&amp;nbsp;ocamlopt -a -o experts.cmxa expert_isunknown.ml expert_ispage.ml ...
&lt;br&gt;&lt;br&gt;but ocaml now triggers following error by compiling foo.ml with
&lt;br&gt;experts.cmxa:
&lt;br&gt;&lt;br&gt;Unbound module Experts
&lt;br&gt;&lt;br&gt;How to do this correctly?
&lt;br&gt;&lt;br&gt;Bye Andreas
&lt;br&gt;-- 
&lt;br&gt;Andreas Romeyke
&lt;br&gt;- Abteilung Blindenschrift -
&lt;br&gt;Deutsche Zentralbücherei für Blinde zu Leipzig (DZB)
&lt;br&gt;Gustav-Adolf-Straße 7, 04105 Leipzig
&lt;br&gt;Tel: +49 341 7113-..., Fax: +49 341 7113-125
&lt;br&gt;Internet: www.dzb.de
&lt;br&gt;E-Mail: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26572801&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;andreas.romeyke@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;[Non-text portions of this message have been removed]
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---Creating-Library-tp26572801p26572801.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26543935</id>
	<title>strange expression type mismatch</title>
	<published>2009-11-27T07:29:31Z</published>
	<updated>2009-11-27T07:29:31Z</updated>
	<author>
		<name>I</name>
	</author>
	<content type="html">Hi all !
&lt;br&gt;First of all please excuse me for my bad english...
&lt;br&gt;&lt;br&gt;I have this noobish problem...
&lt;br&gt;I have a function in file B that has as formal parameters, variables
&lt;br&gt;of type A.a1, A.a2 and so on .
&lt;br&gt;When i try to call this function from file A i get this compilation error : 
&lt;br&gt;&lt;br&gt;File &amp;quot;A.ml&amp;quot;, line 88, characters 63-64:
&lt;br&gt;Error: This expression has type
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;instruction = inst_type * element * element * element
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;but an expression was expected of type
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A.instruction =
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A.inst_type * A.element *
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A.element * A.element
&lt;br&gt;&lt;br&gt;instruction as you can imagine is defined in A as 
&lt;br&gt;type instruction = inst_type * element * element * element.
&lt;br&gt;&lt;br&gt;Ah and before i forget, the types instruction, inst_type,element are the types A.a1,A.a,...
&lt;br&gt;I mentioned before.
&lt;br&gt;&lt;br&gt;Thanks you all for your help !!</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/strange-expression-type-mismatch-tp26543935p26543935.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26535496</id>
	<title>&quot;ocaml_beginners&quot;::[] Re: indentation question</title>
	<published>2009-11-26T14:02:58Z</published>
	<updated>2009-11-26T14:02:58Z</updated>
	<author>
		<name>Vincent Aravantinos</name>
	</author>
	<content type="html">Hi
&lt;br&gt;&lt;br&gt;--- In &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26535496&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners@...&lt;/a&gt;, Martin DeMello &amp;lt;martindemello@...&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; is this an omlet.vim bug, or am i doing something stylistically wrong?
&lt;br&gt;&amp;gt; i expected the 'done' matching the 'for j' to outdent.
&lt;br&gt;&lt;br&gt;It works perfectly well on my machine.
&lt;br&gt;I think you should not use omlet : it has been integrated into vim quite a long time ago.
&lt;br&gt;Omlet is probably outdated now w.r.t. the standard vim-ocaml plugin.
&lt;br&gt;&lt;br&gt;V.
&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---indentation-question-tp26532382p26535496.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26533654</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] indentation question</title>
	<published>2009-11-26T10:56:42Z</published>
	<updated>2009-11-26T10:56:42Z</updated>
	<author>
		<name>Richard Jones-4</name>
	</author>
	<content type="html">On Thu, Nov 26, 2009 at 10:37:35PM +0530, Martin DeMello wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; is this an omlet.vim bug, or am i doing something stylistically wrong?
&lt;br&gt;&amp;gt; i expected the 'done' matching the 'for j' to outdent.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; let refresh_board screen cfg q =
&lt;br&gt;&amp;gt; &amp;nbsp; acquire_screen();
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; for i = 0 to (cfg.m - 1) do
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; for j = 0 to (cfg.n - 1) do
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; let col = board_color q.board.(i).(j) in
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; let x1, y1, x2, y2 = cell_boundaries i j in
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; rectfill screen x1 y1 x2 y2 col
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; done
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; done;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; release_screen()
&lt;/div&gt;&lt;br&gt;I'd say that's a vim bug. &amp;nbsp;Here's how emacs / tuareg-mode formats it:
&lt;br&gt;&lt;br&gt;let refresh_board screen cfg q =
&lt;br&gt;&amp;nbsp; acquire_screen();
&lt;br&gt;&lt;br&gt;&amp;nbsp; for i = 0 to (cfg.m - 1) do
&lt;br&gt;&amp;nbsp; &amp;nbsp; for j = 0 to (cfg.n - 1) do
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; let col = board_color q.board.(i).(j) in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; let x1, y1, x2, y2 = cell_boundaries i j in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; rectfill screen x1 y1 x2 y2 col
&lt;br&gt;&amp;nbsp; &amp;nbsp; done
&lt;br&gt;&amp;nbsp; done;
&lt;br&gt;&lt;br&gt;&amp;nbsp; release_screen()
&lt;br&gt;&lt;br&gt;Rich.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Richard Jones
&lt;br&gt;Red Hat
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---indentation-question-tp26532382p26533654.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26532500</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] indentation question</title>
	<published>2009-11-26T09:12:08Z</published>
	<updated>2009-11-26T09:12:08Z</updated>
	<author>
		<name>Martin DeMello</name>
	</author>
	<content type="html">oops, looks like gmail destroyed the formatting. here's a pastie:
&lt;br&gt;&lt;a href=&quot;http://pastebin.org/57496&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://pastebin.org/57496&lt;/a&gt;&lt;br&gt;martin
&lt;br&gt;&lt;br&gt;On Thu, Nov 26, 2009 at 10:37 PM, Martin DeMello
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26532500&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;martindemello@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; is this an omlet.vim bug, or am i doing something stylistically wrong?
&lt;br&gt;&amp;gt; i expected the 'done' matching the 'for j' to outdent.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; let refresh_board screen cfg q =
&lt;br&gt;&amp;gt; acquire_screen();
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; for i = 0 to (cfg.m - 1) do
&lt;br&gt;&amp;gt; for j = 0 to (cfg.n - 1) do
&lt;br&gt;&amp;gt; let col = board_color q.board.(i).(j) in
&lt;br&gt;&amp;gt; let x1, y1, x2, y2 = cell_boundaries i j in
&lt;br&gt;&amp;gt; rectfill screen x1 y1 x2 y2 col
&lt;br&gt;&amp;gt; done
&lt;br&gt;&amp;gt; done;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; release_screen()
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;------------------------------------
&lt;br&gt;&lt;br&gt;Archives up to December 31, 2008 are also downloadable at &lt;a href=&quot;http://www.connettivo.net/cntprojects/ocaml_beginners/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.connettivo.net/cntprojects/ocaml_beginners/&lt;/a&gt;&lt;br&gt;The archives of the very official ocaml list (the seniors' one) can be found at &lt;a href=&quot;http://caml.inria.fr&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://caml.inria.fr&lt;/a&gt;&lt;br&gt;Attachments are banned and you're asked to be polite, avoid flames etc.Yahoo! Groups Links
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To visit your group on the web, go to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://groups.yahoo.com/group/ocaml_beginners/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groups.yahoo.com/group/ocaml_beginners/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; Your email settings:
&lt;br&gt;&amp;nbsp; &amp;nbsp; Individual Email | Traditional
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To change settings online go to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://groups.yahoo.com/group/ocaml_beginners/join&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groups.yahoo.com/group/ocaml_beginners/join&lt;/a&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; (Yahoo! ID required)
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To change settings via email:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26532500&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners-digest@...&lt;/a&gt; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26532500&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners-fullfeatured@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; To unsubscribe from this group, send an email to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26532500&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ocaml_beginners-unsubscribe@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&amp;lt;*&amp;gt; Your use of Yahoo! Groups is subject to:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://docs.yahoo.com/info/terms/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://docs.yahoo.com/info/terms/&lt;/a&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---indentation-question-tp26532382p26532500.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26532382</id>
	<title>&quot;ocaml_beginners&quot;::[] indentation question</title>
	<published>2009-11-26T09:07:35Z</published>
	<updated>2009-11-26T09:07:35Z</updated>
	<author>
		<name>Martin DeMello</name>
	</author>
	<content type="html">is this an omlet.vim bug, or am i doing something stylistically wrong?
&lt;br&gt;i expected the 'done' matching the 'for j' to outdent.
&lt;br&gt;&lt;br&gt;let refresh_board screen cfg q =
&lt;br&gt;&amp;nbsp; acquire_screen();
&lt;br&gt;&lt;br&gt;&amp;nbsp; for i = 0 to (cfg.m - 1) do
&lt;br&gt;&amp;nbsp; &amp;nbsp; for j = 0 to (cfg.n - 1) do
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; let col = board_color q.board.(i).(j) in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; let x1, y1, x2, y2 = cell_boundaries i j in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; rectfill screen x1 y1 x2 y2 col
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; done
&lt;br&gt;&amp;nbsp; &amp;nbsp; done;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; release_screen()
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/%22ocaml_beginners%22%3A%3A---indentation-question-tp26532382p26532382.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26532496</id>
	<title>&quot;ocaml_beginners&quot;::[] Re: Combinations of lists -- tail recursive</title>
	<published>2009-11-26T09:07:04Z</published>
	<updated>2009-11-26T09:07:04Z</updated>
	<author>
		<name>Zheng Li-5</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;I came up with the following snippet. Hopefully it's tail recursive and can save you a few list flips.
&lt;br&gt;&lt;br&gt;---- code ----
&lt;br&gt;open List
&lt;br&gt;let comb lol =
&lt;br&gt;&amp;nbsp; let _,lol = fold_left (fun (r,a) l -&amp;gt; not r, (if r then rev l else l)::a) (true,[]) lol in
&lt;br&gt;&amp;nbsp; fold_left (fun ll -&amp;gt; fold_left (fun tl e -&amp;gt; fold_left (fun t l -&amp;gt; (e::l)::t) tl ll) []) [[]] lol
&lt;br&gt;--------------
&lt;br&gt;&lt;br&gt;and
&lt;br&gt;&lt;br&gt;---- test ----
&lt;br&gt;# comb[[1;2]];;
&lt;br&gt;- : int list list = [[1]; [2]]
&lt;br&gt;# comb[[1;2];[3;4;5]];;
&lt;br&gt;- : int list list = [[1; 3]; [1; 4]; [1; 5]; [2; 3]; [2; 4]; [2; 5]]
&lt;br&gt;# comb[[1;2];[3;4;5];[6;7]];;
&lt;br&gt;- : int list list =
&lt;br&gt;[[1; 3; 6]; [1; 3; 7]; [1; 4; 6]; [1; 4; 7]; [1; 5; 6]; [1; 5; 7]; [2; 3; 6];
&lt;br&gt;&amp;nbsp;[2; 3; 7]; [2; 4; 6]; [2; 4; 7]; [2; 5; 6]; [2; 5; 7]]
&lt;br&gt;--------------
&lt;br&gt;&lt;br&gt;Cheers
&lt;br&gt;Zheng
&lt;br&gt;&lt;br&gt;&lt;br&gt;citromatik wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; In a previous post some weeks ago, I asked for advice in getting a function
&lt;br&gt;&amp;gt; that gets all possible combinations of a list of lists using 1 element of
&lt;br&gt;&amp;gt; each sublist. i.e.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; # comb;;
&lt;br&gt;&amp;gt; comb: 'a list list -&amp;gt; 'a list list
&lt;br&gt;&amp;gt; # comb [[1;2];[3;4;5];[6;7]];;
&lt;br&gt;&amp;gt; [[1;3;6];[1;3;7];[1;4;6];[1;4;7];[1;5;6];[1;5;7];[2;3;6];[2;3;7]...]
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; A couple of possible solutions were given (thanks to all who replied), but
&lt;br&gt;&amp;gt; unfortunately I am getting stack overflows in complex (real) list of lists.
&lt;br&gt;&amp;gt; So I think I need a tail recursive solution.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Also I was told to write functions that does the job for a list with n
&lt;br&gt;&amp;gt; elements (sublists) and write one (using the former) for a list with
&lt;br&gt;&amp;gt; n+1 elements. And finally, turn this into a recursive function.
&lt;br&gt;&amp;gt; That is what I tried:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; (* Function that build a lol adding the element e to each element of l *)
&lt;br&gt;&amp;gt; let combo1N e l =
&lt;br&gt;&amp;gt; List.map (fun x -&amp;gt; x::e::[]) l
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; (* Combinations of 2 lists using the former *)
&lt;br&gt;&amp;gt; let comboNN l1 l2 =
&lt;br&gt;&amp;gt; let rec aux acc l =
&lt;br&gt;&amp;gt; match l with
&lt;br&gt;&amp;gt; [] -&amp;gt; List.flatten acc
&lt;br&gt;&amp;gt; | h::t -&amp;gt; aux ((combo1N h l2)::acc) t
&lt;br&gt;&amp;gt; in aux [] l1
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; (* Combinations of 3 lists using the former *)
&lt;br&gt;&amp;gt; let comboNNN l1 l2 l3 =
&lt;br&gt;&amp;gt; let rec aux acc l =
&lt;br&gt;&amp;gt; match l with
&lt;br&gt;&amp;gt; [] -&amp;gt; List.flatten acc
&lt;br&gt;&amp;gt; | h::t -&amp;gt; aux ((List.fold_left (fun acc x -&amp;gt; (h::x)::acc) [] (comboNN l2
&lt;br&gt;&amp;gt; l3))::acc) t
&lt;br&gt;&amp;gt; in aux [] l1
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Having that I end up with a recursive function that does the job:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; (* Combinations of lol -- recursive *)
&lt;br&gt;&amp;gt; let rec combo (lol:'a list list) =
&lt;br&gt;&amp;gt; match lol with
&lt;br&gt;&amp;gt; | x::y::[] -&amp;gt; List.fold_left (fun acc e -&amp;gt; ((List.map (fun x -&amp;gt; x::e::[]))
&lt;br&gt;&amp;gt; x)@acc) [] y (* = comboNN x y *)
&lt;br&gt;&amp;gt; | l::lot -&amp;gt;
&lt;br&gt;&amp;gt; let rec aux acc l =
&lt;br&gt;&amp;gt; match l with
&lt;br&gt;&amp;gt; | [] -&amp;gt; List.flatten acc
&lt;br&gt;&amp;gt; | h::t -&amp;gt; aux ((List.fold_left (fun acc x -&amp;gt; (h::x)::acc) [] (combo
&lt;br&gt;&amp;gt; lot))::acc) t
&lt;br&gt;&amp;gt; in aux [] l
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Unfortunately, there are still cases where I get an stack overflow error, so
&lt;br&gt;&amp;gt; I need to write the function in a tail recursive form.
&lt;br&gt;&amp;gt; My last attempt was this:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; let combo (lol:'a list list) =
&lt;br&gt;&amp;gt; let rec aux1 acc1 (l1:'a list list) =
&lt;br&gt;&amp;gt; match l1 with
&lt;br&gt;&amp;gt; | [] -&amp;gt; acc1
&lt;br&gt;&amp;gt; | x::[] -&amp;gt; comboNN x (List.flatten acc1)
&lt;br&gt;&amp;gt; | h1::t1::tl -&amp;gt;
&lt;br&gt;&amp;gt; aux1 ((
&lt;br&gt;&amp;gt; let rec aux2 acc2 (l2:'a list) =
&lt;br&gt;&amp;gt; match l2 with
&lt;br&gt;&amp;gt; [] -&amp;gt; List.flatten acc2
&lt;br&gt;&amp;gt; | h2::t2 -&amp;gt; aux2 ((List.fold_left (fun acc x -&amp;gt; (h2::x)::acc) []
&lt;br&gt;&amp;gt; (aux1 ([t1]) tl))::acc2) t2
&lt;br&gt;&amp;gt; in aux2 [] h1)@acc1) (t1::tl)
&lt;br&gt;&amp;gt; in aux1 [(List.hd lol)] (List.tl lol)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; But this doesn't work. I'm trying to bend my mind a bit more, but any help
&lt;br&gt;&amp;gt; would be appreciated.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Thanks in advance,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; M;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Combinations-of-lists----tail-recursive-tp26529218p26532496.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26530071</id>
	<title>Re: &quot;ocaml_beginners&quot;::[] Combinations of lists -- tail recursive</title>
	<published>2009-11-26T06:16:23Z</published>
	<updated>2009-11-26T06:16:23Z</updated>
	<author>
		<name>Martin Jambon</name>
	</author>
	<content type="html">Martin Jambon wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; citromatik wrote:
&lt;br&gt;&amp;gt;&amp;gt; In a previous post some weeks ago, I asked for advice in getting a function
&lt;br&gt;&amp;gt;&amp;gt; that gets all possible combinations of a list of lists using 1 element of
&lt;br&gt;&amp;gt;&amp;gt; each sublist. i.e.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; # comb;;
&lt;br&gt;&amp;gt;&amp;gt; comb: 'a list list -&amp;gt; 'a list list
&lt;br&gt;&amp;gt;&amp;gt; # comb [[1;2];[3;4;5];[6;7]];;
&lt;br&gt;&amp;gt;&amp;gt; [[1;3;6];[1;3;7];[1;4;6];[1;4;7];[1;5;6];[1;5;7];[2;3;6];[2;3;7]...]
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; A couple of possible solutions were given (thanks to all who replied), but
&lt;br&gt;&amp;gt;&amp;gt; unfortunately I am getting stack overflows in complex (real) list of lists.
&lt;br&gt;&amp;gt;&amp;gt; So I think I need a tail recursive solution.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Also I was told to write functions that does the job for a list with n
&lt;br&gt;&amp;gt;&amp;gt; elements (sublists) and write one (using the former) for a list with
&lt;br&gt;&amp;gt;&amp;gt; n+1 elements. And finally, turn this into a recursive function.
&lt;br&gt;&amp;gt;&amp;gt; That is what I tried:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; (* Function that build a lol adding the element e to each element of l *)
&lt;br&gt;&amp;gt;&amp;gt; let combo1N e l =
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; List.map (fun x -&amp;gt; x::e::[]) l
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; (* Combinations of 2 lists using the former *)
&lt;br&gt;&amp;gt;&amp;gt; let comboNN l1 l2 =
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; let rec aux acc l =
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; match l with
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; [] -&amp;gt; List.flatten acc
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; | h::t -&amp;gt; aux ((combo1N h l2)::acc) t
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; in aux [] l1
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; (* Combinations of 3 lists using the former *)
&lt;br&gt;&amp;gt;&amp;gt; let comboNNN l1 l2 l3 =
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; let rec aux acc l =
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; match l with
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; [] -&amp;gt; List.flatten acc
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; | h::t -&amp;gt; aux ((List.fold_left (fun acc x -&amp;gt; (h::x)::acc) [] (comboNN l2
&lt;br&gt;&amp;gt;&amp;gt; l3))::acc) t
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; in aux [] l1
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Having that I end up with a recursive function that does the job:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; (* Combinations of lol -- recursive *)
&lt;br&gt;&amp;gt;&amp;gt; let rec combo (lol:'a list list) =
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; match lol with
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; | x::y::[] -&amp;gt; List.fold_left (fun acc e -&amp;gt; ((List.map (fun x -&amp;gt; x::e::[]))
&lt;br&gt;&amp;gt;&amp;gt; x)@acc) [] y (* = comboNN x y *)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; | l::lot -&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; let rec aux acc l =
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; match l with
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | [] -&amp;gt; List.flatten acc
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | h::t -&amp;gt; aux ((List.fold_left (fun acc x -&amp;gt; (h::x)::acc) [] (combo
&lt;br&gt;&amp;gt;&amp;gt; lot))::acc) t
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; in aux [] l
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Unfortunately, there are still cases where I get an stack overflow error, so
&lt;br&gt;&amp;gt;&amp;gt; I need to write the function in a tail recursive form.
&lt;br&gt;&amp;gt;&amp;gt; My last attempt was this:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; let combo (lol:'a list list) =
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; let rec aux1 acc1 (l1:'a list list) =
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; match l1 with
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; | [] -&amp;gt; acc1
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; | x::[] -&amp;gt; comboNN x (List.flatten acc1)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; | h1::t1::tl -&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; aux1 ((
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let rec aux2 acc2 (l2:'a list) =
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; match l2 with
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [] -&amp;gt; List.flatten acc2
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | h2::t2 -&amp;gt; aux2 ((List.fold_left (fun acc x -&amp;gt; (h2::x)::acc) []
&lt;br&gt;&amp;gt;&amp;gt; (aux1 ([t1]) tl))::acc2) t2
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; in aux2 [] h1)@acc1) (t1::tl)
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; in aux1 [(List.hd lol)] (List.tl lol)
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; But this doesn't work. I'm trying to bend my mind a bit more, but any help
&lt;br&gt;&amp;gt;&amp;gt; would be appreciated.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I did not follow the thread at the time, but here is what I would do:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; let iter_product f ll =
&lt;br&gt;&amp;gt; &amp;nbsp; let aa = Array.map Array.of_list (Array.of_list ll) in
&lt;br&gt;&amp;gt; &amp;nbsp; let n = Array.length aa in
&lt;br&gt;&amp;gt; &amp;nbsp; let zero = Array.make n 0 in
&lt;br&gt;&amp;gt; &amp;nbsp; let rec next p q =
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; (f q : unit);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; (try
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for i = 0 to n - 1 do
&lt;br&gt;&amp;gt; 	 let pi = p.(i) + 1 in
&lt;br&gt;&amp;gt; 	 let m = Array.length aa.(i) in
&lt;br&gt;&amp;gt; 	 if pi &amp;gt;= m then (
&lt;br&gt;&amp;gt; 	 &amp;nbsp; p.(i) &amp;lt;- 0;
&lt;br&gt;&amp;gt; 	 &amp;nbsp; q.(i) &amp;lt;- aa.(i).(0)
&lt;br&gt;&amp;gt; 	 )
&lt;br&gt;&amp;gt; 	 else (
&lt;br&gt;&amp;gt; 	 &amp;nbsp; p.(i) &amp;lt;- pi;
&lt;br&gt;&amp;gt; 	 &amp;nbsp; q.(i) &amp;lt;- aa.(i).(pi);
&lt;br&gt;&amp;gt; 	 &amp;nbsp; raise Exit
&lt;br&gt;&amp;gt; 	 )
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;done
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;with Exit -&amp;gt; ()
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; );
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if p &amp;lt;&amp;gt; zero then
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; next p q
&lt;br&gt;&amp;gt; &amp;nbsp; in
&lt;br&gt;&amp;gt; &amp;nbsp; next (Array.make n 0) (Array.init n (fun i -&amp;gt; aa.(i).(0)))
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; let build_product ll =
&lt;br&gt;&amp;gt; &amp;nbsp; let accu = ref [] in
&lt;br&gt;&amp;gt; &amp;nbsp; iter_product (fun p -&amp;gt; accu := Array.copy p :: !accu) ll;
&lt;br&gt;&amp;gt; &amp;nbsp; !accu
&lt;/div&gt;&lt;br&gt;Or this ;-) &amp;nbsp;:
&lt;br&gt;&lt;br&gt;&lt;br&gt;let flatten ll =
&lt;br&gt;&amp;nbsp; List.rev (List.fold_left (fun accu l -&amp;gt; List.rev_append l accu) [] ll)
&lt;br&gt;&lt;br&gt;let map f l =
&lt;br&gt;&amp;nbsp; List.rev (List.rev_map f l)
&lt;br&gt;&lt;br&gt;let combine ll =
&lt;br&gt;&amp;nbsp; let rec comb accu = function
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; [] -&amp;gt; accu
&lt;br&gt;&amp;nbsp; &amp;nbsp; | l :: ll -&amp;gt;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; let accu =
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; flatten (
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map (fun x -&amp;gt; map (fun l -&amp;gt; x :: l) accu) l
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; comb accu ll
&lt;br&gt;&amp;nbsp; in
&lt;br&gt;&amp;nbsp; comb [[]] (List.rev ll)
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Martin
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;&lt;a href=&quot;http://mjambon.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mjambon.com/&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Combinations-of-lists----tail-recursive-tp26529218p26530071.html" />
</entry>

</feed>
