# Simplifying Lambda Syntax

Evaluating lambda functions requires using lots of brackets, which can be tedious and are a major source of error for evaluating expressions by hand. To simplify expressions, you can omit brackets when it is clear what the intention of the function is. Particularly, a function application can omit the brackets surrounding each individual parameter and assume the function is applied to the nearest argument. So, instead of expressing a function of three arguments as

$$(((f \: a1) \: a2) \: a3)$$

We can write

$$f \: a1 \: a2 \: a3$$

A second simplification of notation is defining functions. Instead of defining a function using the full lambda syntax already described, we can drop the $\lambda$ symbol and move any variables of the function definition to the left of the $=$ sign. This means a function definition like

$$def \: f = \lambda\langle name \rangle. \langle expression \rangle$$

can be expressed as

$$def \: f \langle name \rangle = \langle expression \rangle$$

Using this syntactic sugar, we can express common functions like identity in a simplified format.

$$def \: identity = \lambda x.x$$

becomes

$$def \: identity \: x = x$$

You will see this simplified syntax used to express lambda expressions more succinctly, especially when we start building more complex lambda expressions that rely on conditional logic or recursion.

Like this post? Subscribe via RSS or email to never miss an update.