<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="gmail_quote"><font face="arial, helvetica, sans-serif">I was surprised that <b>cdr</b> upsets the type-checker? How to fix?</font></div><div class="gmail_quote"><font face="monospace, monospace"><br></font></div><div class="gmail_quote"><font face="monospace, monospace">#lang typed/racket</font></div><div class="gmail_quote"><font face="monospace, monospace"><br></font></div><div class="gmail_quote"><span style="font-family:monospace,monospace">(: atom? (-> Any Boolean))</span><br></div><div class="gmail_quote"><font face="monospace, monospace">(define (atom? a)</font></div><div class="gmail_quote"><font face="monospace, monospace"> (or (symbol? a) (boolean? a) (number? a) (string? a)))</font></div><div class="gmail_quote"><font face="monospace, monospace"> </font></div><div class="gmail_quote"><font face="monospace, monospace">(: lat? (-> (List Any) Boolean))</font></div><div class="gmail_quote"><font face="monospace, monospace">(define (lat? l)</font></div><div class="gmail_quote"><font face="monospace, monospace"> (cond </font></div><div class="gmail_quote"><font face="monospace, monospace"> [(null? l) #t]</font></div><div class="gmail_quote"><font face="monospace, monospace"> [(atom? (car l)) (lat? (cdr l))]</font></div><div class="gmail_quote"><font face="monospace, monospace"> [else #f]))</font></div><div class="gmail_quote"><font face="monospace, monospace"><br></font></div><div class="gmail_quote"><font face="monospace, monospace"><br></font></div><div class="gmail_quote"><font face="monospace, monospace" color="#ff0000"><div class="gmail_quote">Type Checker: Polymorphic function `cdr' could not be applied to arguments:</div><div class="gmail_quote">Types: (Pairof a b) -> (b : ((! False @ (cdr) (0 0)) | (False @ (cdr) (0 0))) : (cdr (0 0)))</div><div class="gmail_quote"> (Listof a) -> (Listof a)</div><div class="gmail_quote">Arguments: (List Any)</div><div class="gmail_quote">Expected result: (List Any)</div><div class="gmail_quote"> in: (cdr l)</div></font></div></div><div class="gmail_signature"><div dir="ltr"></div></div>
</div></div>