[Newbies] Re: How to shorten a method (using inject: into: ?)
Zulq Alam
me at zulq.net
Mon Jul 21 21:41:05 UTC 2008
Using #inject:into and Point objects to store the totals:
testMaleMeiosis4
| totals |
totals := Forecaster testMale meiose inject: 0 at 0 into:
[:subtotals :strand |
subtotals + (strand maternalCount @ strand maternalCount)].
self should: [totals = 100 at 100]
The point notation makes it look very clean (to me).
Z
stan shepherd wrote:
> So until the next cunning suggestion
More information about the Beginners
mailing list