Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] language shoot-out :-)

From: petr:krenzelok:trz:cz at: 3-Nov-2002 19:24

Hi, I reread interview with DocKimbel and found following link to language comparison page: http://www.bagley.org/%7Edoug/shootout/ So those of you having enough free time or just simply interested could rewrite some examples into Rebol to see, where do we stand ... Here is matrix example roughly translated form Python to Rebol ... (http://www.bagley.org/%7Edoug/shootout/bench/matrix/) mkmatrix: func [rows cols][ count: 1 mx: array/initial reduce [rows cols] 0 for i 1 rows 1 [ for j 1 cols 1 [ poke mx/:i j count count: count + 1 ] ] return mx ] mmult: func [rows cols m1 m2][ m3: array/initial reduce [rows cols] 0 for i 1 rows 1 [ for j 1 cols 1 [ val: 0 for k 1 cols 1 [ val: val + (m1/:i/:k * m2/:k/:j) poke m3/:i j val ] ] ] return m3 ] mxprint: func [m][ for i 1 size 1 [ for j 1 size 1 [ print [m/:i/:j newline] ] ] ] main: func [iter size][ m1: mkmatrix size size m2: mkmatrix size size for i 1 iter 1 [ mm: mmult size size m1 m2 ] print [mm/1/1 mm/3/4 mm/4/3 mm/5/5] ] start: now/time/precise main 1 30 print ["Result time:" now/time/precise - start] ... after finishing it though I returned back to the site, but results are not expressed in time value on certain level CPU, so any kind of comparison is useless probably ... maybe someone here uses Python and wants to compare? :-) -pekr-