#lang typed/racket (define (a (n : Exact-Nonnegative-Integer)) : Exact-Nonnegative-Integer (if (even? n) (add1 n) (sub1 n)))
(define (b (n : Exact-Nonnegative-Integer)) : Exact-Nonnegative-Integer ((if (even? n) add1 sub1) n)) Function a goes well, but function b gives an error during expansion: Type Checker: type mismatch expected: Nonnegative-Integer given: Integer in: ((if (even? n) add1 sub1) n) Apparently the type checker deduces that in function a, sub1 will not be applied to zero. Why it can't also detect this for function b? Thanks, Jos -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.