Going from conditional expressions and guarded equations to pattern matching, lambda expressions, and operator sections.

## Conditional Expressions

As in most programming languages, Haskell supports conditional expression, which also can be used to define a function.

## Guarded Equations

Guarded equation is a preferred alternative to a conditional expression in Haskell.

## Pattern Matching

Pattern matching is a simple way to define a function by matching a pattern with an expected result.

Patterns are matched in order of definition, left to right, top to bottom.

Patterns do not repeating arguments.

## List Patterns

Internally, every non-empty list is constructed by repeated use of an operator `:` called cons that adds an element to the start of a list.

Function on a list can be defined using a `x:xs` pattern.

• `x:xs` can only match non-empty lists.
• `x:xs` pattern must be inside parenthesis because of the order of operations.

## Lambda Expressions

A function can be constructed without naming the function by using a lambda expression. For example: `λx -> x + x`.

The symbol `λ` is the Greek letter lambda and in Haskell is denoted with a `\`.

### Usage of Lambda Expressions

Give formal meaning to a curried function.

Define a function that returns another function as a result.

Avoid naming a function that is used once.

## Sections

An operator written between its two arguments can be converted into a curried function written before its two arguments by using parenthesis.

In general if `+` is an operator then functions of the form `(+)`, `(x+)`, `(+y)` are called sections.

### Using Sections

Sections can be used to instead of functions:

• `(+)` is the addition function `\x -> (\y -> x + y)`
• `(1+)` is the successor function `\y -> 1 + y`
• `(1/)` is the reciprocation function `\y -> 1 / y`
• `(*2)` is the doubling function `\x -> x * 2`
• `(/2)` is the halving function `\x -> x / 2`

And that’s that.