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=0.6 required=5.0 tests=NO_REAL_NAME autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 4F6E2BC6D for ; Tue, 23 Jan 2007 20:11:32 +0100 (CET) Received: from webmail3.sd.dreamhost.com (webmail3.sd.dreamhost.com [64.111.100.15]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0NJBW9s018761 for ; Tue, 23 Jan 2007 20:11:33 +0100 Received: from webmail.fischerventure.com (localhost [127.0.0.1]) by webmail3.sd.dreamhost.com (Postfix) with ESMTP id 739AC1428F for ; Tue, 23 Jan 2007 11:10:01 -0800 (PST) Received: from 151.151.21.103 (SquirrelMail authenticated user robert@fischerventure.com) by webmail.fischerventure.com with HTTP; Tue, 23 Jan 2007 11:10:01 -0800 (PST) Message-ID: <59029.151.151.21.103.1169579401.squirrel@webmail.fischerventure.com> In-Reply-To: <3E3A2218-5AA0-445F-A37D-B12EF4A2F9CB@gmail.com> References: <3E3A2218-5AA0-445F-A37D-B12EF4A2F9CB@gmail.com> Date: Tue, 23 Jan 2007 11:10:01 -0800 (PST) Subject: Re: [Caml-list] Simple factorial From: robert@fischerventure.com To: caml-list@yquem.inria.fr User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 45B65DE4.003 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; factorial:01 o'caml:01 factorial:01 overflows:01 rec:01 caml-list:01 argument:02 defined:02 checking:02 let:03 overflow:03 written:07 function:08 function:08 haven't:09 > 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? > You haven't defined a stop condition, so it's going down and down into the negatives until it overflows. ~~ Robert.