caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pietro Abate <abate@discus.anu.edu.au>
To: caml-list@inria.fr
Subject: Re: [Caml-list] self and mutually recursive functions ?
Date: Fri, 11 Oct 2002 20:19:33 +1000	[thread overview]
Message-ID: <20021011101933.GA14232@zed> (raw)
In-Reply-To: <20021010154738.GA12586@rhinoceros.mts>

On Thu, Oct 10, 2002 at 05:47:38PM +0200, Metalscan wrote:
> In each of them, there would be a match with one
> branch returning itself and the other one returning
> the other function.

do you want something like that ?

let rec f1 i =
    match i with
    | 1 -> f1 (i-1)
    | 2 -> f2 (i-1)
    | a -> let _ = Printf.printf "f1 = %d\n" a in a
and f2 j = 
    match j with 
    | 1 -> f2 (j-1)
    | 2 -> f1 (j-1)
    | a -> let _ = Printf.printf "f2 = %d\n" a in a
;; 

# f1 1;;
f1 = 0
- : int = 0
# f1 2;;
f2 = 0
- : int = 0

regards,
p

-- 
pgp key: 1024D/8A091922 2000-10-18 Pietro Abate <abate@arp.anu.edu.au>
Key fingerprint = 5111 D91B 5E0C 5CE6 FDA3  5EF4 6120 E18E 8A09 1922
public key avalaible via public key server at wwwkeys.eu.pgp.net
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


      parent reply	other threads:[~2002-10-11 10:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-10 15:47 Metalscan
2002-10-10 17:19 ` Pierre Weis
2002-10-10 17:59 ` Michel Quercia
2002-10-11 10:19 ` Pietro Abate [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=20021011101933.GA14232@zed \
    --to=abate@discus.anu.edu.au \
    --cc=caml-list@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).