On Mon, 12 Mar 2001, rashworth wrote:
> # The following code does not Sum the squares of the elements.
> # Define class Array for Sum of squares
> class Array
>   def inject(n)
>     each { |value| n = yield(n, value) }
>     n

"nested method definition". you forgot an "end" here.

>   def sumsq
>     inject(0) { | n, value | (n * n) + value }

this should be
      inject(0) { | n, value | n + value*value }

matju