Re: last item. no output

"Roelof Wobben [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
Matthieu Dubuget
[email protected] [ocaml_beginners] schreef op 18-10-2014
13:39:

Â

Le 18/10/2014 13:30, Roelof
Wobben [email protected]
[ocaml_beginners] a écrit :

I
think your remark has to do with this problem :

last [1] ;;                                                                                                                                                                           Â

Error: This expression has type int but an expression was expected of type                                                                                                              Â

         'a list                                                                                                                                        Â

And?

Sébastian is explaining you that you compiled a program
test.native that do nothing.

When you call it, you are passing either "[]" or "[1]" to
this program. Yes: those are strings.

But, since your program does nothing, nothing is done.

Next steps are :

- understand how to make a program do something

- understand how to pass parameters to your program

Let us consider the first problem.

When an ocaml module is loaded, everything is evaluated,
from the first line to the last line.

Create a program with `let doit () = print_endline "Bye!"`.
The only thing it does is defining doit.

This function types as: unit -> unit

If you add 'let () = doit ()', you would now have doit
function be called.

Let's keep the "how to pass and use an parameter" for a next
time…

Salutations

--
Matthieu Dubuget
Guide d’autodéfense numérique : http://guide.boum.org

Thanks,

I forget to tell that I work now in utop and not from a saved file.

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
(5)

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=X3oDMTJkMnViMzR2BF9TAzk3NDc2NTkwBGdycElkAzQ5OTkxOTQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDEzNjMyNzY2

• 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.