Your question is related to this one which has answers pointing out that in R5RS (which I guess MIT scheme partially supports?), the if
with one branch returns an "unspecified value". So the equivalent to the haskell code should be:
(define (f x)
(if (> x 0)
(+ x 1)))
You probably already know this: in haskell undefined
is defined in terms of error
, and is primarily used in development as a placeholder to be removed later. The proper way to define your haskell function would be to give it a type like: Integer -> Maybe Integer
.