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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Steve Taylor <staylor@u...>
Subject: RE: [Caml-list] Factorial function
This function does not terminate where you think it does.  What is your base case?

> -----Original Message-----
> From: caml-list-bounces@yquem.inria.fr [mailto:caml-list-bounces@yquem.inria.fr] On Behalf Of
> Lucas Holland
> Sent: Tuesday, January 23, 2007 10:54 AM
> To: caml-list@inria.fr
> Subject: [Caml-list] Factorial function
> 
> Hi, why does this function:
> 
> let rec fact n =
> 	n * fact (n-1);;
> 
> yield an overflow error if called with n = 5?
> 
> Thanks in advance,
> 
> Lucas
> 
> _______________________________________________
> 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