[racket] `assert' in Typed Racket

From: Richard Lawrence (richard.lawrence at berkeley.edu)
Date: Tue May 24 16:41:15 EDT 2011

Sam Tobin-Hochstadt <samth at ccs.neu.edu>

> (assert x p?) is equivalent to (if (p? x) x (error ...)) except that
> the result is known to have the appropriate type (here `String').

Ah, OK, I think I see my mistake; is this the right way to put it?
Although the expression

(assert x string?)

has type String, and evaluates to the same value as `x' provided that
value is indeed a string, this does not mean that the expression `x' has
type String.



Posted on the users mailing list.