Taking a hint from the comments (yes, I do listen), here is a "less
complex" :) solution:
Complex>>
< aNumber
"Not defined on Complex numbers"
^self asReal < aNumber asReal
Complex>>
asReal
"Answer real-part of self if imaginary is zero else, error"
(imaginary = 0)
ifTrue: [^real]
ifFalse: [self error: 'Can''t convert to real']
Better?
-KenD
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project