lundi 23 février 2015

How/why is this function legal in Ocaml? Also, how would I go about checking if statements like this one are legal in the future?

I'm not sure how to properly go through this function and determine its type. I typed it into an Ocaml top level and the output is "hello world" but I do not know why. Could someone please explain how they determined the final output? Thanks!



let f y =
let z = (let x = 5 in y * x) + y in "hello" in (f 7) ^ " world"

Aucun commentaire:

Enregistrer un commentaire