[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

transitivity does not imply type-checking

In section "Why are <? etc. procedures, not macros?" of the srfi
document it says

... one can even require the compare procedures to check the types of
all arguments, even if the result of the comparison is already
known. This is what Section 6.2.5 of R5RS calls ``transitive`` behavior
of the predicates =, <, etc.

It is true that R5RS requires the predicates to be transitive. However,
I cannot see how that implies that unused arguments must be
type-checked, as is asserted in the above.

Take for example the following definition of =:

(define (= x y . rest)
  (and (number? x) (number? y)
       (prim= x y)
       (or (null? rest) (apply my= y rest))))

I claim that this meets the transitivity requirement of R5RS, assuming
prim= is transitive, yet it only type-checks used args.