Ruby Lambdas
summary
Ruby lambdas are shown as practical tools: they have strict arity checking and return only from the lambda (procs differ), they act as closures, and they work as callables interchangeable with procs or methods. Examples include formatter lambdas in a Rex gem configuration hash, transform chains using inject, partial application and Curry to build triplers, and a worked buffered enumerable class that handles ingestion and yields. A five‑method example gives complexity 20 and refactoring into nested lambdas cuts that complexity to less than a third.
AI-written summary · about
chapters (9)
- 0:00Start
- 2:05Ways to Call a Lambda
- 5:56Self Invoking Anonymous Functions
- 7:55Comparing Lambda and Nonlambda Return Behavior
- 8:41Comparing Lambdas and Procs Arity Checking
- 15:16Lambdas as Nested Functions: Formatters
- 16:37Lambdas in Behavior Lookups
- 25:08Transform Chains - ETL "Lite"
- 26:16Partial Application
related talks
37mFunctional Programming in Ruby
27mYes, &…: Ruby’s Secret Talent for Improvisation
19mFunctional Ruby
34mDon't Fear The Lambda
27mYes, &…: Ruby’s Secret Talent for Improvisation
31mSeeing Metaprogramming and Lambda Function Patterns in Ruby
38mRewriting Rack: A Functional Approach
53mY Not- Adventures in Functional Programming
