Loading ...
Sorry, an error occurred while loading the content.

Re: "ocaml_beginners"::[] OCaml square funciton is not working

Expand Messages
  • Sergei Steshenko
    The OP seems to need square of integers, so why working with floats ? Regards, Sergei. ... From: Arlen Cuss Subject: Re:
    Message 1 of 6 , Feb 28 8:31 PM
    • 0 Attachment
      The OP seems to need square of integers, so why working with floats ?

      Regards,
      Sergei.

      --- On Mon, 2/28/11, Arlen Cuss <celtic@...> wrote:

      From: Arlen Cuss <celtic@...>
      Subject: Re: "ocaml_beginners"::[] OCaml square funciton is not working
      To: ocaml_beginners@yahoogroups.com
      Date: Monday, February 28, 2011, 7:24 PM







       









      [snip]

      But you're better off working with floats, as that's how they're given

      to you by (**).



      HTH,

      Arlen



      On Mon, 2011-02-28 at 19:44 +0000, suresh wrote:

      > I tried the followoing...

      > # square(4);;

      >

      > Characters 0-6:

      > square(4);;

      > ^^^^^^

      > 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

      >

      >

      >
    • Sylvain Le Gall
      Hello, ... 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
      Message 2 of 6 , Mar 1, 2011
      • 0 Attachment
        Hello,

        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;
        -> 4


        Cheers,
        Sylvain Le Gall
        --
        My company: http://www.ocamlcore.com
        Linkedin: http://fr.linkedin.com/in/sylvainlegall
        Start an OCaml project here: http://forge.ocamlcore.org
        OCaml blogs: http://planet.ocamlcore.org
      • Arlen Cuss
        ... Whoops, didn t even think of the definition of a square and just went straight for the exponential ..! A [Non-text portions of this message have been
        Message 3 of 6 , Mar 1, 2011
        • 0 Attachment
          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 ?
          >
          > Regards,
          > Sergei.

          Whoops, didn't even think of the definition of a square and just went
          straight for the exponential ..!

          A


          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.