| Newsgroups |
gmane.comp.lang.ocaml.beginners |
| Message-ID |
<[email protected]> |
This exercise is from that book.
Roelof
Amir Chaudhry [email protected] [ocaml_beginners] schreef op
15-10-2014 18:13:
In case it hasn't been mentioned before, I'd recommend
a book called 'OCaml from the very beginning'. The
exercises there are very useful and I found the
explanations/answers to be clear.
http://ocaml-book.com/
Best wishes,
Amir
--
sent via mobile
On 15 Oct 2014, at 13:34, Roelof Wobben [email protected]
[ocaml_beginners] <[email protected] >
wrote:
Thanks .
Now I understand where I did go wrong.
Roelof
John Whitington [email protected]
[ocaml_beginners] schreef op
15-10-2014 14:32:
Hi,
You're using this syntax
twice, nested:
let <name> =
<expression> in <another expression>
which binds the
<name> (e.g x, to the value of the
<expression> e.g 1)
in <another
expression>.
In your example, we can
insert some parentheses, without changing the
meaning of the expression.
Can you see what's happening now?
let x = 1 in (let x
= 2 in x + x)
--> let x = 1 in 4
--> 4
Thanks,
John
Roelof Wobben [email protected]
[ocaml_beginners] wrote:
oke,
I thought I had to read
it as follows
let x = 1 the first x
in x + x is a 1
let x = 2 so the second
x in x + x is a 2 so it will be 1 + 2 = 3
Roelof
Lukasz Stafiniak [email protected]
[ocaml_beginners] schreef op
15-10-2014 14:21:
On Wed, Oct 15, 2014
at 2:17 PM, Roelof Wobben [email protected]
< mailto:[email protected] >
[ocaml_beginners]
<[email protected]
< mailto:[email protected] >>
wrote:
Hello,
I have this
programm :
let x = 1 in let
x = 2 in x + x
I was expected to
see a outcome of 3 but when I run it I see a
outcome
of 4 ,
Can someone
explain to me why ??
If x is an integer,
then x + x = 2 * x is an even number. 3 is not
an
even number so it
cannot be equal to x + x for any x. Since x = 2,
therefore x + x = 2 +
2 = 4.
Regards.
------------------------------------
------------------------------------
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
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ocaml_beginners/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ocaml_beginners/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an
email to:
[email protected]
<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/
__._,_.___
----------
Posted by: Roelof Wobben <[email protected]>
----------
Reply via web post
•
Reply to sender
•
Reply to group
•
Start a New Topic
•
Messages in this topic
(8)
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=X3oDMTJkdXVtb2RvBF9TAzk3NDc2NTkwBGdycElkAzQ5OTkxOTQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDEzMzkxODYy
• Privacy • Unsubscribe • Terms of Use
.
__,_._,___