-
Do these three declarations define the same thing?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi Arthri, they do. F* functions always unary (take a single argument) and may possibly return another function, like in most functional languages. All three examples define a "two argument" function (i.e. a function returning a function). The second case is just syntactic sugar for the first case, this syntax only helps avoid repeating the In the third case, instead of placing the binders of the left of the equal sign, Internally, there is actually a very tiny difference between f/g and h. In the first two the body has an extra
|
Beta Was this translation helpful? Give feedback.
Hi Arthri, they do.
F* functions always unary (take a single argument) and may possibly return another function, like in most functional languages. All three examples define a "two argument" function (i.e. a function returning a function). The second case is just syntactic sugar for the first case, this syntax only helps avoid repeating the
int
type.In the third case, instead of placing the binders of the left of the equal sign,
h
is defined directly as a lambda term. But the first and second declaration should also desugar to the same thing.Internally, there is actually a very tiny difference between f/g and h. In the first two the body has an extra
int
ascription, but this should not …