On 12 December 2012 11:21, Nala Ginrut <nalagin...@gmail.com> wrote: > It's weird to see that: > (exact? 'a) > ================err msg=============== > ERROR: In procedure exact?: > ERROR: In procedure exact?: Wrong type argument in position 1: a > ==================end================= > > And I have to do this: > (define (fraction? obj) > (and (number? obj) (inexact? obj)))
“Fraction” is not a very precise term or relevent to the type hierarchy in Scheme, please do not use that. Disregard that GOOPS define such a class, the more precise term is “rational” for which there is already a predicate. Your fraction? predicate is not equivalent to the GOOPS <fraction> class, which are exact? and (in all cases I believe) also rational?. > > > Why not 'exact?' and 'inexact?' doesn't check 'number?' first? Performance. They are intended to be used in numerical paths and requiring them to check first number? every time is very inefficient. You will note that they are documented as “exact? Z“ rather than “exact? obj”.