24 lines
587 B
Markdown
24 lines
587 B
Markdown
|
---
|
||
|
type: mixed
|
||
|
---
|
||
|
|
||
|
|
||
|
## Definition
|
||
|
- Pure mathematical functions
|
||
|
- Declarative paradigm
|
||
|
- Instead of writing step-by-step, we define the desired outcome
|
||
|
- Immutable data
|
||
|
- => No/Less side effects
|
||
|
- Programs are easier to verify
|
||
|
- We can mathematically prove the algorithms
|
||
|
|
||
|
|
||
|
## Lazy vs. Strict
|
||
|
- Calculations are delayed until the results are actually needed
|
||
|
|
||
|
### Example
|
||
|
Imagine a list of numbers, but you only need the first one that meets a condition. With lazy evaluation, the program stops processing the list as soon as it finds the result, instead of checking every number.
|
||
|
|
||
|
|
||
|
|