<div>Interestingly</div><div><br></div><div>(require/typed racket<br></div><div> [remove-duplicates ((Listof Any) -> (Listof Any)))])</div><div><br></div><div>works.</div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Nov 1, 2012 at 4:56 PM, John Clements <span dir="ltr"><<a href="mailto:clements@brinckerhoff.org" target="_blank">clements@brinckerhoff.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I can't tell whether this is a bug. In the program below, remove-duplicates doesn't remove duplicates. This looks like an attempt to preserve parametricity a la theorems for free, but I don't think that TR actually tries to guarantee parametricity in this sense. I'm guessing that the values in the list are being wrapped in contracts that prevent 'eq?'-checking; I thought that chaperones were supposed to... no, I shouldn't even finish that sentence.<br>
<br>
Anyhow, I'm just writing to make sure that this isn't a bug. It's certainly not the behavior that I would naively expect. I can certainly work around the bug by substituting a more specific type for remove-duplicates, as in the commented-out version.<br>
<br>
John<br>
<br>
#lang typed/racket<br>
<br>
(require/typed racket<br>
[remove-duplicates (All (T) (Listof T) -> (Listof T))]<br>
#;[remove-duplicates ((Listof Symbol) -> (Listof Symbol))])<br>
<br>
(remove-duplicates '(a b c a d)) ;; => produces '(a b c a d)--that is, a list with duplicates<br>
<br>
<br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>