From: volker_grabsch@... (Volker Grabsch) Date: 2003-07-05T17:23:59+09:00 Subject: Re: Ruby Code Snippet: Array.count In article <3F065223.2030809@pragprog.com>, Dave Thomas wrote: > Stefan Arentz wrote: > I'm starting to like using 'inject' for this kind of thing, but it isn't > as clear to read: > > class Array > def count > inject(0) {|sum, e| yield(e) ? sum + 1 : sum } > end > end Injects are *never* clear to read, are they? >> Ruby is sweet :-) > Agreed :) ACK. Cheers, -- Volker Grabsch ---<<(())>>--- \frac{\left|\vartheta_0\times\{\ell,\kappa\in\Re\}\right|}{\sqrt [G]{-\Gamma(\alpha)\cdot\mathcal{B}^{\left[\oint\!c_\hbar\right]}}}