[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:01853] Re: Matrix Multiplication in Ruby

From: "Dat Nguyen" <thucdat@...>
Date: 2000-03-15 17:48:49 UTC
List: ruby-talk #1853
This is incredible, no nested loops necessary, it's the class Matrix that 
gets the job done!
I gotta erase my memory and think class in Ruby, everything is an object 
like Smalltalk.
But I still see weird prefixes like $ for global variables and @ for local 
ones.
Are they the only prefixes tolerated in Ruby?
Why are they introduced? (Python doesn't have any, maybe it uses 'self' 
instead).

Dat

>From: Dave Thomas <Dave@thomases.com>
>Reply-To: ruby-talk@netlab.co.jp
>To: ruby-talk@netlab.co.jp (ruby-talk ML)
>Subject: [ruby-talk:01846] Re: Matrix Multiplication in Ruby
>Date: 15 Mar 2000 11:21:25 -0600
>
>"Dat Nguyen" <thucdat@hotmail.com> writes:
>
> > I remmeber having seen three code samples in Perl, Tcl & Python to 
>multiply
> > two matrices and store the result into a third matrix.
> >
> > How would the code in Ruby be?
>
>      require 'matrix'
>
>      m1 = Matrix[ [1, 2], [3, 4] ]
>      m2 = Matrix[ [9, 8], [7, 7] ]
>
>      m3 = m1 * m2
>
>
>Dave

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

In This Thread

Prev Next