On Feb 9, 2007, at 6:01 PM, Rodrigo Bermejo wrote:

>
> This snippet contains some of my favorite ruby features
>
> class Array
>    def *(a)
>        n    = Array.new
>        [ self.length, a.length].max.
>        times do |x|
>            n[x] = ( self[x] || 0 ) * ( a[x] || 0 )
>        end
>        n
>    end
> end
> #[ 2,4,4 ]  *  [ 5,5 ]

 >> [2, 4, 4].zip([5, 5]).map { |l, r| (l || 0) * (r || 0) }
=> [10, 20, 0]

> but by far my favorite one liner is:
>
> ruby -r 'fileutils' -e  'FileUtils.rm("/usr/bin/perl")'

That's hilarious!

James Edward Gray II