[plt-scheme] How to make the following code more clear?
Because `largest' doesn't work on empty list.
Chongkai
Eric Tanter wrote:
>> #lang typed-scheme
>> [...]
>> (: largest ((cons α (Listof α)) -> α))
>> ;; pick the largest value from the list
>> (define (largest lst)
>> (foldr max (car lst) (cdr lst)))
>
> any reason why you used (cons a (Listof a)) instead of simply (Listof
> a) in the type signature of largest?
>
> -- Éric_________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme