Hi everyone,
I am sorry for the newbie question. I'm wondering why TypedRacket complains about the following implementation of length
#lang typed/racket
(define #:forall [T] (len [ l : (Listof T)] ) : Number
(match l
[(list) 0]
[(list _ l ...) (+ 1 (len l))] ; <--- error is here (line 6)
)
)
Error:
foo.rkt:6:26: Type Checker: missing type for identifier;
consider adding a type annotation with `:'
identifier: len
in: len
location...:
foo.rkt:6:26
context...:
What exactly is the type annotation that is missing? Isn't function len
annotated with the return type?
FYI,
$ racket --version
Welcome to Racket v8.2 [cs].