Continuations pass control explicitly via callbacks
Image: kees torn, CC BY-SA 2.0, via Wikimedia Commons
Continuations pass control explicitly via callbacks
CPS makes several aspects of programming explicit: procedure returns, intermediate values, order of argument evaluation, and tail calls. This explicitness can lead to clearer and more predictable code.
Example
A simple CPS function in Scheme might look like this: ```scheme (define (cps-func x) (lambda (k) (k (+ x 1)))) ``` Invoking `(cps-func 5)` would return a continuation that adds 1 to its argument.
Remember this
Understanding CPS helps programmers write clearer, more predictable code by making control flow explicit.
Text adapted from Wikipedia, licensed under CC BY-SA 4.0.
Vanishing gradient problem
Residual connections help by allowing gradient flow through the skip connection
loop unrolling does: trades code size for reduced loop overhead
Loop unrolling optimizes execution speed by reducing loop control instructions
Monad (functional programming)
Monads are a type constructor with two operations: return and bind
operator fusion does at the compiler level: merges adjacent ops to reduce memory traffic
Compiler optimizations merge adjacent operations to reduce memory traffic
branch prediction does: guesses which way an if-statement will go to keep the pipeline full
Branch predictors guess the outcome of conditional jumps to keep the pipeline full
Viterbi semiring
How do we find the best path in a maze of choices?
Swipe through 100 ML concepts daily
Open Pocket Polymath