tags : Programming Languages
Meta
- Mutability breaks “referential transparency”: ability to replace expression with ts value without affecting result of computation
- Variables never change value
- Functions never have side effects
Mutation
- Mutation is more than just a way to of getting a computation done, it becomes shared state/communication channel and we want to avoid doing that whenever possible.
- Side-effects is another term for mutations and similar things
Composition
Two things to make composition easier
- Abstractions
- Immutability
Principles/Concepts
Abstraction Principle
The Abstraction Principle says to avoid requiring something to be stated more than once; instead, factor out the recurring pattern. Higher-order functions enable such refactoring, because they allow us to factor out functions and parameterize functions on other functions.
Links
Internet comments
- Unlike imperative programming, functional programming is not a series of “steps” where you just exit when you are done, returning some value. It is instead a mathematical expression.