From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 3C6EFBBAF for ; Tue, 4 Jul 2006 17:54:10 +0200 (CEST) Received: from hedwig1.umh.ac.be (hedwig2.umh.ac.be [193.190.193.73]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k64Fs9eK001062 for ; Tue, 4 Jul 2006 17:54:11 +0200 Received: from poincare.swapping.umh.ac.be (mathwifi.swapping.umh.ac.be [10.102.100.203]) by hedwig1.umh.ac.be (8.13.6/8.13.6) with ESMTP id k64FtVG62547948; Tue, 4 Jul 2006 17:55:31 +0200 Received: from localhost ([127.0.0.1]) by poincare.swapping.umh.ac.be with esmtp (Exim 4.62) (envelope-from ) id 1FxnDY-0001aD-Mj; Tue, 04 Jul 2006 17:53:40 +0200 Date: Tue, 04 Jul 2006 17:53:40 +0200 (CEST) Message-Id: <20060704.175340.175432410.Christophe.Troestler@umh.ac.be> To: albargah@mcmaster.ca Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] beginner From: Christophe TROESTLER In-Reply-To: References: X-Face: #2fb%mPx>rRL@4ff~TVgZ"<[:,oL"`TUEGK/[8/qb58~C>jR(x4A+v/n)7BgpEtIph_neoLKJBq0JBY9:}8v|j Organization: Universite de Mons-Hainaut (http://math.umh.ac.be/an/) X-Spook: Merlin fraud ASIO colonel Janet Reno IMF Bush Wired Venezuela Syria Montenegro X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Operating-System: Debian GNU/Linux (http://www.debian.org/) X-Mailer: Mew version 4.2.52 on Emacs 22.0.50 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.1 (www dot roaringpenguin dot com slash mimedefang) X-Miltered: at nez-perce with ID 44AA8F21.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 troestler:01 christophe:01 troestler:01 umh:01 ocaml:01 recursive:01 rec:01 cheers:01 wrote:01 unbound:01 caml-list:01 functions:01 functions:01 func:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Tue, 4 Jul 2006, Aws Albarghouthi wrote: > > I am an ocaml beginner and I am trying to modify an open source > application. I'm facing the problem that functions within a file > can't call each other. I'm getting the error Unbound value . This is normal. let f ... = ... let g ... = ... The function g can use f but f cannot call g because g is not known at that point. If f must also call g, then f and g are mutually recursive and you should declare them as let rec f ... = ... and g ... = ... You can also group your functions as methods of an object (these can call each other) : object(self) method f ... = ... self#g ... method g ... = ... self#f ... end Cheers, ChriS