How to Write a Fast, Reducible Collection
summary
Shows how to implement IReduceInit to make a collection that produces values without lazy seqs by calling the reducing function on each produced item, immediately checking reduced? and unwrapping to stop early. Demonstrates a simple range implementation with an index loop, using the three-arity reduce signature so transducers and into work (take short-circuits correctly). Gives a JDBC ResultSet example and a generic stateful producer pattern with a fin marker for replacing line-seq.
AI-written summary · about
chapters (12)
- 0:00Intro
- 0:18Stream Fusion
- 0:43What is Stream Fusion
- 0:53Transducers
- 2:07Example
- 2:40Improvements
- 2:50Interface
- 3:11Steps
- 3:32Lazy Seek
- 3:42Skeleton
- 4:33Early Termination
- 6:04Outro
related talks
43mReducers
38mLost in Transduction
01h 01mTransforming Data using the Functional API
31mlazy-seq – a historic view and why it is misunderstood
40mAn Introduction to Combinator Compilers and Graph Reduction Machines
49mJava Functional Programming Idioms
38mThe Lord of Collection Functions: The Fellowship of Kotlin
01h 00m“Transducers: from Clojure to C++"
