From: "Kontra, Gergely" Date: 2002-06-07T01:23:14+09:00 Subject: Re: Array.foldr (Array.reduce) >On Thursday 06 June 2002 07:55 am, Kontra, Gergely wrote: >If I understand you, you could just do this: > ># used like: ># foldr(e, array) { |partial,b| partial+b } > >def foldr(e, array) > result = e > array.reverse_each { |elem| result = yield(result, elem) } > result >end Thanks for your solution. Will these (and similarly general?) methods be in the next release, or you try to keep ruby as compact as possible? 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