[plt-scheme] How to make the following code more clear?

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Mon Oct 13 15:28:01 EDT 2008

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



Posted on the users mailing list.