Functional Programming
WebPPL looks like JavaScript, but in practice it should be treated as a functional fraction of JavaScript.
Contents
- Functional programming basics
- Cache (memoization)
- What
cachedoes - Why this matters for functional programming
- When
cacheis safe: pure/deterministic computations - Example: caching an expensive deterministic computation
- When
cacheis a modeling tool: one latent value per key - Good modeling example: a stable latent trait per individual
- When
cacheis dangerous: you accidentally remove independence - Bad example: you wanted a fresh coin flip every time
- A simple rule of thumb
- See also
- Executable example
- What