Hans Sjunnesson
1/19/2006 3:24:00 PM
I'm fairly new to Ruby and I've just come across something I find odd.
I can't seem to assign a value to an element of a Vector.
The following snippet:
require 'matrix'
v = Vector[10, 20, 30]
v[0] = 30
Will give a NoMethodError exception like so:
NoMethodError: undefined method `[]=' for Vector[10, 20, 30]:Vector
from (irb):3
So, is this intentional design? Is the idea to use Arrays when you want
to modify initial elements?
--
Hans Sjunnesson