Erik Veenstra <erikveen / dds.nl> writes:

>  ([0]+row).zip(row+[0]).map{|a,b|a+b}   ===> [1, 4, 6, 4, 1]
>
> You can replace the last line by the next line, but this one
> modifies the previous row, which might be tricky. Though it
> does save you one extra byte ;]
>
>  ([0]+row).zip(row<<0).map{|a,b|a+b}    ===> [1, 4, 6, 4, 1]

Actually, you can save two characters by a simple variation on the
initial zip version that removes the need for parens, with no in-place
modification of "row":

   row.zip([0]+row).map{|a,b|a+b}+[1]

> You could build and store the complete triangle with this:
>
>  t=[r=[1]]+(2..n).map{r=([0]+r).zip(r+[0]).map{|a,b|a+b}}

Minimal-number-of-characters-wise, at this point you're better off not
using the pascal triangle recurrence relation and just using the
properties of binomial coefficients:

   t=(0..n).map{|i|r=1;[1]+(1..i).map{|a|r=r*(i+1-a)/a}}

I'm a little bit surprised at the paucity of solutions based around
sprintf-format strings.  I'll have to write up my sprintf-based idea
tonight or tomorrow.