caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe TROESTLER <Christophe.Troestler@umh.ac.be>
To: albargah@mcmaster.ca
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] beginner
Date: Tue, 04 Jul 2006 17:53:40 +0200 (CEST)	[thread overview]
Message-ID: <20060704.175340.175432410.Christophe.Troestler@umh.ac.be> (raw)
In-Reply-To: <B4E073D4-0775-4C69-8246-C9EEA76B50E7@mcmaster.ca>

On Tue, 4 Jul 2006, Aws Albarghouthi <albargah@mcmaster.ca> 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 <func name>.

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


      parent reply	other threads:[~2006-07-04 15:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-04 15:17 beginner Aws Albarghouthi
2006-07-04 15:45 ` [Caml-list] beginner Till Varoquaux
2006-07-04 15:53 ` Christophe TROESTLER [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060704.175340.175432410.Christophe.Troestler@umh.ac.be \
    --to=christophe.troestler@umh.ac.be \
    --cc=albargah@mcmaster.ca \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).