[plt-scheme] Re: polymorphism of primitive types
Matthias Felleisen wrote:
> Now you can use it as advertised and it is contracted.
I don't believe so.
> But it would blow up on this:
>
> (let/ec jump
> (mymap (lambda (x y) (if (= x y) (jump #f) (+ x y))) '(1 2 .
> 3) '(1 . 2)))
>
> Should it? -- Matthias
The jump is a red herring here. The function breaks even without
escaping continuations:
(mymap (lambda (x y) (+ x y)) '(1 2 . 3) '(1 . 2)))
I believe the problem is in has-at-least-as-many-cons-as. In
particular, you don't use the min argument except to decrement it at
each recursion, so the function returns true just when list? would.
Since there is rarely a chance to get so say this sort of thing, I'll
take my opportunity now: Matthias, use the recipe.
David