Collection squared but what about fractions.
Randal L. Schwartz
merlyn at stonehenge.com
Tue Jun 5 00:42:29 UTC 2001
>>>>> "Andreas" == Andreas Raab <Andreas.Raab at gmx.de> writes:
Andreas> John,
Andreas> How about making a little tweak in Fraction along the lines of:
Fraction> * aNumber
Andreas> self == aNumber ifTrue:[
Andreas> "special case for squaring fractions"
Andreas> ^self squared]
Andreas> "...."
Andreas> This might even help in some other cases (note that the above uses #== to
Andreas> prevent doing a full comparison in case of a non-fractional argument).
Does that actually make sense? Are all 1/2's identical? I can see
using "=", but not "==".
Just tested:
(1/2) == (1/2) false
(1/2) = (1/2) true
So, nope, that true branch would most likely never get triggered.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <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!
More information about the Squeak-dev
mailing list
|