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

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Oct 13 15:33:34 EDT 2008

I wish this were the reason. Turns out car and cdr are applicable to  
(Listof X) just as much as they are in ML and Haskell. These aren't  
type errors but variant errors. I, however, prefer to express the  
stronger theorem when the language accommodates it. In this regard,  
Chongkai is correct,

-- Matthias

On Oct 13, 2008, at 3:28 PM, Chongkai Zhu wrote:

> 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.