From: "Kontra, Gergely" Date: 2002-06-06T23:55:00+09:00 Subject: Array.foldr (Array.reduce) Hi! I've noticed ruby has nice high level functions. But I cannot find the reduce or foldr method. I've discovered the inject method in the Ruby book. It is very similar to one of the fold(l/r) methods in SML. The def of foldr is: where + denotes any kind of operator with 2 operands e is the (right) unit element folr e + array = array1 + (array2 + ... + (arrayn + e)...) And foldl is the other way (if + is associative, then it gives the same result) If inject will be available, will foldl and foldr (=reduce) also? Thanks in advance. Gergo +-[Kontra, Gergely @ Budapest University of Technology and Economics]-+ | Email: kgergely@mcl.hu, kgergely@turul.eet.bme.hu | | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 | +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+ . Magyar php mirror es magyar php dokumentacio: http://hu.php.net