>>>>> "Ariel" == Ariel Scolnicov <[EMAIL PROTECTED]> writes: Ariel> reduce needs to be able to take an (optional?) "distinguished element" Ariel> to start from. Consider this: Ariel> reduce sum () == 0 Ariel> reduce times () == 1 Ariel> reduce catenate () == '' Ariel> Where do we get the right one from? In Smalltalk, it's called "inject:into:", and yes, you're providing both a distinguished "initial" value, and a 2-argument block, along with the list to process. "smalltalk: " result _ (1 to: 10) inject: 0 into: [:a :b | a + b] "this is sum" "perl: "; @result = reduce { $a + $b } 0, (1..10); # sum -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
- Random items (old p5p issues) Chaim Frenkel
- Re: Random items (old p5p issues) Chaim Frenkel
- Re: Random items (old p5p issues) Piers Cawley
- Re: Random items (old p5p issues) Chaim Frenkel
- Re: Random items (old p5p issues) Dan Sugalski
- Re: Random items (old p5p issues) Ariel Scolnicov
- Re: Random items (old p5p issues) Johan Vromans
- Reduce [was: Re: Random items (old p5p issues)] Ariel Scolnicov
- Re: Reduce [was: Re: Random items (old p5p iss... Randal L. Schwartz
- Re: Reduce [was: Re: Random items (old p5p iss... Graham Barr
- Re: Reduce [was: Re: Random items (old p5p... raptor
- Re: Reduce [was: Re: Random items (old p5p... Gisle Aas
- Re: Reduce [was: Re: Random items (old... Graham Barr
- Re: Reduce [was: Re: Random items... John Porter
- Re: Reduce [was: Re: Random i... Graham Barr
- Expanding the language pr... Dan Sugalski
- Re: Expanding the languag... Johan Vromans
- Re: Expanding the languag... Dan Sugalski
- Re: Reduce [was: Re: Random i... Tom Christiansen