From: robert@fischerventure.com
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Simple factorial
Date: Tue, 23 Jan 2007 11:10:01 -0800 (PST) [thread overview]
Message-ID: <59029.151.151.21.103.1169579401.squirrel@webmail.fischerventure.com> (raw)
In-Reply-To: <3E3A2218-5AA0-445F-A37D-B12EF4A2F9CB@gmail.com>
> 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.
next prev parent reply other threads:[~2007-01-23 19:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-23 18:50 Lucas Holland
2007-01-23 19:04 ` [Caml-list] " Tom
2007-01-23 19:10 ` robert [this message]
2007-01-23 19:11 ` Dário Abdulrehman
2007-01-23 19:50 ` Till Varoquaux
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=59029.151.151.21.103.1169579401.squirrel@webmail.fischerventure.com \
--to=robert@fischerventure.com \
--cc=caml-list@yquem.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