Laziness, trampolines, monoids and other functional amenities
summary
Shows concrete Java 8 code: implements currying for converters and composes a Celsius↔Fahrenheit pipeline; models salary rules as composed endomorphisms and uses monoid composition to build reusable calculators; demonstrates that naive infinite streams for primes blow the stack, then builds a lazy list and a trampoline to produce an infinite prime generator without StackOverflowError; measures no compiler TCO in Java so the trampoline and suppliers are necessary workarounds, and the examples compile and run as shown.
AI-written summary · about
chapters (30)
- 0:00Intro
- 0:20Laziness
- 6:08Essence of Functional Programming
- 8:36Higher-order functions
- 9:47A strategy pattern Converter
- 10:41Using the Converter
- 11:58A functional Converter
- 13:51Currying
- 16:13More Function Composition
- 20:15Endomorphisms & Monoids
- 24:02FluentEndo Monoid
- 26:06A Functional Salary Calculator ...
- 28:52Lary Evaluation
- 29:02Creating a Stream of prime numbers
- 31:10Recursively creating a stream of primes
- 33:35Lazy evaluation in Scala
- 34:02Implementing a lary list in Java
- 34:53and its lary filter
- 36:19Back to generating primes
- 37:10Printing primes
- 37:47Iteration vs. Recursion
- 42:29Another Recursive Example
- 43:23What's the problem?
- 44:07Tail Call Optimization
- 45:51from Recursion to Tail Recursion
- 47:42Tail Recursion in Scala
- 48:53Tail Recursion in Java?
- 49:14Trampolines to the rescue
- 49:54Implementing the TailCall
- 51:49Using the Trampoline








