#25 Procs for Text (willow_and_anya.rb)
As I was planning the functional programming chapter of this book, I was watching DVDs of Joss Whedon’s Buffy the Vampire Slayer. I mention this because I had Procs and blocks on my brain, and I happened to encounter two very good candidates for text-based examples of lambda
operations. In an episode called “Him,” there is discussion of a “love spell”, an “anti-(love spell) spell”, and an “anti-(anti-(love spell) spell) spell”. That’s a great example of successive modifications via a simple function. In another episode called “Same Time, Same Place,” there is a conversation that demonstrates simple variable substitution. Both are great examples of simple functions and are good venues to explore how Procs ...
Get Ruby by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.