Is an OCaml function of signature:
'a -> 'b
possible?
I think it might be possible, however, I would not know the underlying logic behind the answer, so having it explained would be great :)
EDIT: It cannot recursively loop forever
There are several "legitimate" answers. One is to loop forever, which you ruled out:
let rec f x = f x
Another is to diverge by raising an exception or terminating the program:
let f x = exit 0
let f x = assert false
let f x = failwith "die"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With