Wrapping Up

Procs and lambdas are powerful tools to have in your Ruby arsenal. Their purpose is simple: to allow pieces of code to be carried around. However, the consequences are far-reaching.

Developers have been using functional programming techniques in Ruby code to great effect. It’s hard to imagine idiomatic Ruby code without functions like map and reduce. However, in order to write idiomatic code using Procs and lambdas, it’s important to understand its usages and nuances.

In a beautifully meta sort of way, Procs and lambdas have been exploited to enhance the Ruby language itself, with Symbol#to_proc as a shining example. Now that you’ve gone through the implementation of Symbol#to_proc, hopefully you realize that there is absolutely no magic involved.

In the next and final chapter, you will put all the knowledge gained from the previous chapters into practice as you implement your own lazy Enumerable. Remember to attempt the exercises first, though. See you in the next chapter!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.70.101