]
Sent: viernes, 09 de septiembre de 2016 22:21
To: Jos Koot
Cc: Racket Users
Subject: Re: [racket-users] typed racket confusion
Because in function `b`, the type of the `lambda` that `n` actually be passed
to is the union of `add1` and `sub1` in the context,
hence, the info on parity of `n
Because in function `b`, the type of the `lambda` that `n` actually be
passed to is the union of `add1` and `sub1` in the context,
hence, the info on parity of `n` are lost before this `lambda` is evaluated.
On Sat, Sep 10, 2016 at 3:42 AM, Jos Koot wrote:
> #lang
#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
3 matches
Mail list logo