From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=AWL,HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id C16FCBC0B for ; Wed, 24 Jan 2007 18:14:14 +0100 (CET) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.238]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0OHEDGP013708 for ; Wed, 24 Jan 2007 18:14:14 +0100 Received: by nz-out-0506.google.com with SMTP id i11so201742nzh for ; Wed, 24 Jan 2007 09:14:13 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=Y0p5St9jRAN+svrbkeiy85WkEZcpWyhOXMNI0FrmC7cZ8rWwSyCIxHU8po9+cmtnBK0orqiW4ffqiBQvgro+8IqzBWkuDgjbJRboyS/tXxwTVKbD9elHEKUAPrJ0rC9Szp0LyZcKQogeZ8sdrKJpv6fmJ+nWFiypCb3w5/j/pnI= Received: by 10.35.9.15 with SMTP id m15mr13505979pyi.1169579512217; Tue, 23 Jan 2007 11:11:52 -0800 (PST) Received: by 10.35.111.7 with HTTP; Tue, 23 Jan 2007 11:11:52 -0800 (PST) Message-ID: <6aeedf580701231111r32503ee5te3a01e6100a1b1aa@mail.gmail.com> Date: Tue, 23 Jan 2007 19:11:52 +0000 From: "=?ISO-8859-1?Q?D=E1rio_Abdulrehman?=" To: "Lucas Holland" Subject: Re: [Caml-list] Simple factorial Cc: caml-list@yquem.inria.fr In-Reply-To: <3E3A2218-5AA0-445F-A37D-B12EF4A2F9CB@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_250255_22275643.1169579512184" References: <3E3A2218-5AA0-445F-A37D-B12EF4A2F9CB@gmail.com> X-j-chkmail-Score: MSGID : 45B793E5.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45B793E5.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; factorial:01 ocaml:01 recursion:01 o'caml:01 factorial:01 beginner's:01 ocaml:01 bug:01 recursion:01 o'caml:01 beginner's:01 bug:01 rio:98 lucas:98 lucas:98 ------=_Part_250255_22275643.1169579512184 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, Join http://tech.groups.yahoo.com/group/ocaml_beginners/ . The yahoo list is more appropriate for beginner questions (I am a beginner too). Anyway, whatever the programming language you are using, you need to define a base case for recursion... On 1/23/07, Lucas Holland wrote: > > Hello, > > I've just started learning O'Caml. I've written a simple factorial > function (no checking whether n is 1 etc.): > > let rec factorial n = > n * factorial (n-1);; > > When I call this function with let's say 5 as an argument, I get an > overflow error message. > > Any ideas? > > chell > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > ------=_Part_250255_22275643.1169579512184 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi,

Join http://tech.groups.yahoo.com/group/ocaml_beginners/ .
The yahoo list is more appropriate for beginner questions (I am a beginner too).

Anyway, whatever the programming language you are using, you need to define a base case for recursion...



On 1/23/07, Lucas Holland < hollandlucas@gmail.com> wrote:
Hello,

I've just started learning O'Caml. I've written a simple factorial
function (no checking whether n is 1 etc.):

let rec factorial n =
        n * factorial (n-1);;

When I call this function with let's say 5 as an argument, I get an
overflow error message.

Any ideas?

chell

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

------=_Part_250255_22275643.1169579512184--