This program:
#lang typed/racket
(define n : Real 5)
(for/list ([i : Natural (in-range n)]) : (Listof Natural)
  i)
And this program:
#lang typed/racket
(define n : Real 5)
(for/list ([i : Natural (identity (in-range n))]) : (Listof Natural)
  i)
The first one produces an error:
. Type Checker: type mismatch
  expected: Nonnegative-Integer
  given: Integer in: (for/list ((i : Natural (in-range n))) : (Listof Natural) 
i)
The second one works fine:
'(0 1 2 3 4)
But why does the first one produce integer, but wrapping it in identity make it 
produce Nonnegative-Integer (Natural) ?



____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to