Jaws - coming soon - testers and advice wanted
chandru
chandrashekhar.mullaparthi@REDACTED
Mon Feb 20 12:11:05 CET 2006
On 20/02/06, Matthias Lang <matthias@REDACTED> wrote:
> Joe Armstrong (AL/EAB) writes:
>
> > Here's a simple example, assumed to be in the file foo.jaws
>
> > <form method="post" action="./foo.jaws?page=posted">
> > <input name="fac" size="20">
> > </form>
> ...
> > <p>Fac <? N ?> is <? red(fac(N)) ?>
> ...
> > << computationally <? fac(N) ?> is about 10-20 times faster than PHP
> > and it works for bignums :-) >>
>
> What happens if someone enters N=123456789?
>
> Does the whole erlang node crash and burn, dumping out _all_ users on
> the site?
This isn't a "problem" with Jaws though. Even if you had a plain web
form which submitted this value, you'd still run into the same problem
if your factorial function naively accepted this value.
fac(N) when is_integer(N) and (N > 1000) -> {error, nice_try};
fac(0) -> 1;
fac(N) -> N * fac(N-1).
Chandru
More information about the erlang-questions
mailing list