% $Id: matrix.slang,v 1.0 2003/01/03 13:59:00 dada Exp $ % http://dada.perl.it/shootout/ % % contributed by John E. Davis variable size = 30; define mkmatrix(rows, cols) { variable mx = [1:rows*cols]; reshape (mx, [rows, cols]); return mx; } define main() { variable iter = integer (__argv[1]); variable m1 = mkmatrix(size, size); variable m2 = mkmatrix(size, size); loop (iter) variable mm = m1 # m2; vmessage ("%.0f %.0f %.0f %.0f", mm[0,0], mm[2,3], mm[3,2], mm[4,4]); } main ();