Optimising your code with math
summary
Shows how equational reasoning and category theory cut a naive O(n^3) max-subarray (all segments → sums → max) down to O(n) by recognizing a monoid homomorphism (Horner’s-rule–style) and replacing maps with a single scan/fold, uses monoids/free applicatives to analyze algebraic effects so some effects become statically parallelizable, builds a small generative‑art language whose canvas effect is a monoid so folds run in parallel and whose hylomorphism enables extra parallel folds.
AI-written summary · about
chapters (8)
- 0:00Start
- 0:28optimising code with
- 3:41why does it not work in javascript ?
- 24:21What's parallelism?
- 26:36real world case PL for generative art
- 28:44Context and Random are boring, tho
- 30:56Takeaways
- 31:40Parallelism can come for free!
related talks
21mGraded Monoids for Dependently Typed Array Programming
25mA well-known representation of monoids and its application to the function ‘vect...
55mMonoids, Monoids, Monoids
57mApplied category theory and abstract algebra
31mAbstract nonsense
37mGoing bananas with recursion schemes for fixed point data types
42mMonoidal Parsing
52mCategory Theory Through Functional Programming (part 1/3)
