X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=topics%2Fweek2_lambda_intro.mdwn;h=6bbb53991b855a73c57de344a56d24c0756ea83b;hp=e8aa8467c3f9339ee37210651d7e9121d6cecc5a;hb=HEAD;hpb=31cebc8050836005ee17dd1d20ae81b2ab9afa3c diff --git a/topics/week2_lambda_intro.mdwn b/topics/week2_lambda_intro.mdwn index e8aa8467..6bbb5399 100644 --- a/topics/week2_lambda_intro.mdwn +++ b/topics/week2_lambda_intro.mdwn @@ -198,9 +198,7 @@ and: z (\x (x y)) -**Dot notation** Dot means "assume a left paren here, and the matching right -paren as far to the right as possible without creating unbalanced -parentheses". So: +**Dot notation** Dot means "Insert a left parenthesis here, and the matching right parenthesis as far to the right as possible without creating unbalanced parentheses---so long as doing so would enclose an application or abstract not already wrapped in parentheses." Thus: \x (\y (x y)) @@ -229,11 +227,14 @@ abbreviates: ((\x (\y (x y))) x) The outermost parentheses were added because we have an application. `(\x. \y. -...)` became `(\x (\y. ...))` because of the rule for dots. We didn't have to +...)` became `(\x (\y. ...))` because of the rule for dots. We didn't insert any parentheses around the inner body of `\y. (x y)` because they were already there. That is, in expressions of the form `\y. (...)`, the dot abbreviates nothing. It's harmless to write such a dot, though, and it can be conceptually -helpful especially in light of the next convention... +helpful especially in light of the next convention. + +Similarly, we permit `\x. x`, which is shorthand for `\x x`, not for `\x (x)`, which +our syntax forbids. (The [[lambda evaluator|/code/lambda_evaluator]] however tolerates such expressions.) **Merging lambdas** An expression of the form `(\x (\y M))`, or equivalently, `(\x. \y. M)`, can be abbreviated as: