[racket] Typed racket problem

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Sun Nov 30 15:26:09 EST 2014

At Sun, 30 Nov 2014 16:38:02 +0100,
Manfred Lotz wrote:
> 1. You offered assert? as an alternative. Is this preferable in
> comparison to cast?

Yes. Assertions are simple first order checks, and are quite
inexpensive. Casts, on the other hand, use contracts and may require
wrapping for mutable data or higher-order types.

> 2. My solution seems to be bad because the decision about the type
> happens at runtime. 

I wouldn't be too worried about the cost of assertions, they're usually
quite cheap. If you want to know whether assertions are slowing your
program down, try using the `feature-profile` package. It reports the
cost of various language features, including assertions.


Posted on the users mailing list.