O'Reilly logo

Ruby by Example by Kevin C. Baird

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

#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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required