Ruby: TPK Algorithm in Different Programming Languages

I was looking for some exercise problems for a programming class I am teaching and encountered Knuth’s TPK problem on http://cs.fit.edu/~ryan/compare/ comparing solutions in different languages but did not find my favorite language and thought I would do it in Ruby and may be submit for inclusion there.

The TPK algorithm reads in an array of 11 values, applies a particular function to each value, and then writes the result in reverse order. It serves just to illustrate some of the usual actions that an imperative programming language must perform.