Version française
Home     About     Download     Resources     Contact us    
Browse thread
Simple factorial
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dário_Abdulrehman <drehman31@g...>
Subject: Re: [Caml-list] Simple factorial
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
>