>>>>> "Zulq" == Zulq Alam <[EMAIL PROTECTED]> writes:

Zulq> Hi Stan,
Zulq> How about using #detectSum:?

Zulq> testMaleMeiosis2          
Zulq>   pTotal := Forecaster testMale meiose
Zulq>           detectSum: [:strand | strand testRun paternalCount].
Zulq>   mTotal := Forecaster testMale meiose
Zulq>           detectSum: [:strand | strand testRun maternalCount].    
Zulq>   self should: [mTotal = 100 and: [pTotal = 100]]         

Huh?  Why the heck is that called #detectSum: instead of just #sum:?
I was trying to find that.  That'd shorten my previous one even more:

testRuns := Forecaster testMale meiose collect: [:e | e testRun].
pTotal := testRuns detectSum: [:e | e paternalCount].
mTotal := testRuns detectSum: [:e | e maternalCount].

No redundant calculations, although we're building an array in the middle that
will be a throwaway.

/me makes a note to look under #detectFoo: next time

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to