Re: Re: Float not working.

"Roelof Wobben [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
Chingfan Tsao [email protected]
[ocaml_beginners] schreef op 16-10-2014 16:34:

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成员

Correct, I think.

when I do #require "Float" I see a message that float cannot be
found.

Roelof

__._,_.___

----------

Posted by: Roelof Wobben <[email protected]>
----------

Reply via web post

•

Reply to sender

•

Reply to group

•

Start a New Topic

•

Messages in this topic
(7)

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.

Visit Your Group

https://groups.yahoo.com/neo;_ylc=X3oDMTJkcGZqaGNtBF9TAzk3NDc2NTkwBGdycElkAzQ5OTkxOTQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDEzNDcwMzM2

• Privacy • Unsubscribe • Terms of Use

.

__,_._,___
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.