Re: "ocaml_beginners":: OCaml square funciton is not working
- The OP seems to need square of integers, so why working with floats ?
--- On Mon, 2/28/11, Arlen Cuss <celtic@...> wrote:
From: Arlen Cuss <celtic@...>
Subject: Re: "ocaml_beginners":: OCaml square funciton is not working
Date: Monday, February 28, 2011, 7:24 PM
But you're better off working with floats, as that's how they're given
to you by (**).
On Mon, 2011-02-28 at 19:44 +0000, suresh wrote:
> I tried the followoing...
> # square(4);;
> Characters 0-6:
> Error: Unbound value square
> sqrt is working fine though.
> Can some one help me please?
> Archives up to December 31, 2010 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners
> The archives of the very official ocaml list (the seniors' one) can be found at http://caml.inria.fr
> Attachments are banned and you're asked to be polite, avoid flames etc.Yahoo! Groups Links
On 01-03-2011, Sergei Steshenko <sergstesh@...> wrote:
> The OP seems to need square of integers, so why working with floats ?
You can keep working on integer. The square function for integers is
maybe just too trivial to be part of the standard library (whereas the
square root is not that trivial).
# let square x = x * x;;
# square 2;
Sylvain Le Gall
My company: http://www.ocamlcore.com
Start an OCaml project here: http://forge.ocamlcore.org
OCaml blogs: http://planet.ocamlcore.org
- On Mon, 2011-02-28 at 20:31 -0800, Sergei Steshenko wrote:
> The OP seems to need square of integers, so why working with floats ?Whoops, didn't even think of the definition of a square and just went
straight for the exponential ..!
[Non-text portions of this message have been removed]