[racket] Little Schemer, lat?
I think you want to use `(Listof Any)`.
Sam
On Thu, Jan 8, 2015 at 6:18 PM, Daniel Prager <daniel.a.prager at gmail.com> wrote:
> I was surprised that cdr upsets the type-checker? How to fix?
>
> #lang typed/racket
>
> (: atom? (-> Any Boolean))
> (define (atom? a)
> (or (symbol? a) (boolean? a) (number? a) (string? a)))
>
> (: lat? (-> (List Any) Boolean))
> (define (lat? l)
> (cond
> [(null? l) #t]
> [(atom? (car l)) (lat? (cdr l))]
> [else #f]))
>
>
> Type Checker: Polymorphic function `cdr' could not be applied to arguments:
> Types: (Pairof a b) -> (b : ((! False @ (cdr) (0 0)) | (False @ (cdr) (0
> 0))) : (cdr (0 0)))
> (Listof a) -> (Listof a)
> Arguments: (List Any)
> Expected result: (List Any)
> in: (cdr l)
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>