Summary of my “reduce” series

May 15, 2014 . By Reuven

I teach Ruby and Python to a lot of people — in formal courses, and in one-on-one pairing sessions, both online and in person.  I’ve found that for many people, the whole notion of functional programming seems strange and difficult, as well as something of a waste of time.  After all, if you have objects, why would you need functional programming?

The answer, of course, is that no single paradigm has all of the answers; each has its strengths and weaknesses.  Understanding how to use them together can provide great benefits.  As a result, I spend time when teaching both Ruby and Python on the basics of functional programming, and then the various functions and methods that each language provides in this area.

Of these, the function that most often causes people to wrinkle their noses and/or get confused is “reduce”.  And to be honest, I often tell students in my classes that “reduce” is one of those functions that is incredibly powerful and clever, but for which you sometimes need to wait in order to find a use case.  I decided to explore some use cases, and ways in which “reduce” could be used — and I hope that these have been useful.

To summarize, here are the posts that I wrote on this topic:

I hope that this series has been useful and interesting, and would appreciate hearing ideas for additional deep-dives into areas of Python, Ruby, or programming in general.  What subjects do you find confusing?  What methods do you think are somewhat useless?  Let me know, and I’ll try to address them in future blog posts!

 

Related Posts

Prepare yourself for a better career, with my new Python learning memberships

Prepare yourself for a better career, with my new Python learning memberships

I’m banned for life from advertising on Meta. Because I teach Python.

I’m banned for life from advertising on Meta. Because I teach Python.

Sharpen your Pandas skills with “Bamboo Weekly”

Sharpen your Pandas skills with “Bamboo Weekly”
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>