| Newsgroups |
gmane.comp.lang.ocaml.beginners |
| Message-ID |
<CAOCiaG4j7xfV1mTDrr+EJusS81-6=Vz4b_TTYNpw+7uyvGCsxQ@mail.gmail.com> |
Hi
Actually, float_of_int is a function belonging to the standard module
Pervasives which is default to be opened. That's why you can directly use
float_of_int instead of Pervasives.float_of_int.
However, if you use utop and type in float_of_int, it will give you:
> [ `Deprecated_use_float_module ] -> [ `Deprecated_use_float_module ] =
<fun>
which suggests you use Float module, in this case, Float.of_int.
The problem here is your REPL can not find the module Float, I believe
there's something missing in your init script.
For example, I have
> #require "core"
and sorts of things to inform utop to load the core suit so that it can be
aware of things like Float module.
Hopefully helpful.
2014-10-16 20:57 GMT+08:00 Hendrik Boom [email protected]
[ocaml_beginners] <[email protected]>:
>
>
> On Thu, Oct 16, 2014 at 12:44:15PM +0200, Roelof Wobben [email protected]
> [ocaml_beginners] wrote:
> > Hello,
> >
> > I try some examples of the realword Ocaml book but now I see this output
> :
> >
> > # let ratio x y = Float.of_int x / Float.of_int y ;;
> > Error: Unbound module Float
>
> I checked an old program of mine, and it used
> float_of_int i
> instead of
> Float.of_int x
>
> Here's the program it was extracted from, in case you're interested.
> http://topoi.pooq.com/hendrik/dv/free/fun/wander/index.html
>
> It's a bit of a bear to compile, because it uses the glMlite library,
> and you'll probably have to get its source code and compile yourself,
> because the glMlite library that's available in opam, the usual OCaml
> package system, is incomplete.
>
> But even if you don't run it, it contains examples of running OCaml
> code, which might be helpful.
>
> -- hendrik
>
> > # open Core.std ;;
> > Error: Syntax error
> > # open Core.Std ;;
> > Error: Unbound module Core
> >
> > How to solve this ?
> >
> > Roelof
> >
> >
> >
> > ------------------------------------
> > Posted by: Roelof Wobben <[email protected]>
> > ------------------------------------
> >
> > Archives up to December 31, 2011 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
> >
> >
> >
>
>
--
曹竞帆
哈尔滨工业大学计算机科学与技术专业本科在读
哈尔滨工业大学IBMTC成员