开发者

Lambda Calculus operators precedence

开发者 https://www.devze.com 2023-02-06 10:18 出处:网络
I have problems understanding lambda calculus operators precedence. For example the following code: lambda x.x z lambda y.x y

I have problems understanding lambda calculus operators precedence.

For example the following code:

lambda x.x z lambda y.x y

is going to be:

lambda x. (x (z lambda y. x y))

or

lambda x. ((x z) (lambda y. x y))

?

Even more complicated examples:

(lambda x.x z) lambda y.w lambda w.w x y z

where in the above example the parentheses go ?

I know that lambda application is le开发者_如何学运维ft associative but does lambda values have higher precedence over applications?


Application has higher precedence than abstraction. Together with the fact that application is left-associative and abstraction is right-associative, this leads to the following:

lambda x.x z lambda y.x y

is

lambda x. ( (x z) (lambda y. (x y)) )

and

(lambda x.x z) lambda y.w lambda w.w x y z

is

(lambda x. (x z)) (lambda y. (w (lambda w. (((w x) y) z))))
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号