[racket-dev] promise vs polym contracts
On Fri, Jul 6, 2012 at 6:53 PM, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
>
> I don't care about typed definitions.
Sam didn't have a "typed" definition, just a "type" definition, note
the significant "d" suffix.
> And yes, in an untyped world, you'd write
>
> (define (sum lt)
> (cond
> [(promise? lt) lt]
> [else (+ (sum (car lt)) (sum (cdr lt)))]))
In an untyped world, you could write the same function that Sam did.
> Note the mistake you made in forcing too early.
Sam didn't force anything too early. He only forced anything in the
branch that accepts promises.
-----