From: jim Date: Sat, 14 Feb 2015 15:37:51 +0000 (-0500) Subject: clarify dot rule X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=28e1ddd1aefa8348ad1c7aaf6cb3bc818c595e57 clarify dot rule --- 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: