From: mopthisandthat@... (Phidippus) Date: 2004-03-13T00:09:51+09:00 Subject: Re: saving array Sorry. NArray is not a standard package. I got it from http://www.ir.isas.ac.jp/~masa/ruby/index-e.html Thanks. Archit Baweja wrote in message news:... > Hmm is narray.rb part of ruby-1.8.x? or a separate package? I'm guessing > that the yaml package implements the #to_yaml method for all the containers > (array, hash etc) which are part of ruby "main". (all thanks to open class > definitions in ruby =D ). So if narray.rb is not part of the stdlib, they > wouldn't have implemented the #to_yaml for you. > > Solutions? In your program you can do something like > > class NArray > def to_yaml () > ... #Implementation (sorry I'm not familiar with NArray) > end > end > > Archit > > P.S. On further scrutiny it revealed that narray.rb is indeed NOT a part > of the stdlib > > irb(main):002:0> require 'narray' > LoadError : No such file to load -- narray > from (irb):2:in `require' > from (irb):2 > irb(main):003:0> require 'narray.rb' > LoadError : No such file to load -- narray.rb > from (irb):3:in `require' > from (irb):3 > irb(main):004:0> x = NArray.new > NameError : uninitialized constant NArray > from (irb):4 > irb(main):005:0> > > > mopthisandthat@hotmail.com (Phidippus) writes: > > > Thank you for the responses. But I forgot to mention one thing. My > > arrays are multidimensional arrays of class NArray (using narray.rb). > > I tried using YAML and marshalling, but they do not seem to work > > (although I may be doint totally wrong). If you can, please give me > > further advices. > > > > Thank you so much. > > T.O. > > > > > > mopthisandthat@hotmail.com (Phidippus) wrote in message news:... > > > After I do bunch of computations and create a huge array with bunch of > > > numbers, I like to use the already-computed array in another program > > > rather than re-computing it each time I run the program. How can I > > > save the array object in one program and read it from another program > > > in ruby?