- Functional Programming
An interesting idea in FP is to separate the producer of values from the consumer.
Example 1: Pretty print
Question: How to select without going through the entire stream?
- This depends on the problem to be solved
- Thought: Same idea as generating ramanujan numbers in SICP.
Example 2: QuickCheck
Example 3: Intel processor design
Program with whole values
- i.e. Think in terms of operations on whole values without going into the minutae
- Thought: Example: A map reduce over a list to calculate sum vs a for loop
- The for loop forces you to specify the intermediate state.
- We understand the for loop by mentally executing it
- The Map Reduce we can understand by understanding the operations applied.
- Some practical limits due to the Von-Neumann bottleneck
Choose a design that satisfies simple rules
- Simple rules create powerful bottom-up compositions
Disadvantage of laziness
- Lazy evaluation causes some uncertainty in the exact time of computation.
- One solution is to use debuggers and program analyzers to improve performance.
- Small changes can cause large performance differences
- This could be a good things in that iteration can cause rapid changes in performance.