In yesterday’s post, I showed how we can use Python’s “reduce” function to create a dictionary.  Ruby, of course, also has dictionaries, but calls them “hashes.”  In this posting, I’m going to show how we can create a hash in Ruby when iterating over an enumerable.  In so doing, we’ll ...

Read More

In the first few parts of this series (first, second, and third), I introduced the “reduce” function, and showed how it can be used in a number of ways. However, in all of the examples we have seen so far, the output from our invocations of “reduce” were integers or ...

Read More

This is the second installment of my series of blog posts on the “reduce” function/method.  For an introduction, see here. I love to play Scrabble — or more commonly nowadays, I play Words with Friends on my phone. (I often say that the game should instead be called, “Words with people ...

Read More

One of the notable things about MIT’s computer science curriculum, at least back when I was studying there, was that you didn’t learn any “practical” programming languages.  Our work was all done in either Scheme (a dialect of Lisp) or in CLU (an early object-oriented language).  I can’t say that ...

Read More

I’ve been using rvm for many years, and love it.  Yes, I know that it rewrites simple commands, such as “ruby” and “gem”, so that I can use lots of different Ruby versions.  Yes, I know that it can be overkill for certain situations.  And yes, I know that rbenv ...

Read More