On this page:
2.6.1 Incomplete Programs

2.6 Controlling Evaluation


seq : (forall [a b] {a -> b -> b})

Accepts two arguments and returns its second argument. When the result is forced, the first argument will also be evaluated to weak head normal form. This can be used to reduce laziness.


error! : (forall [a] {String -> a})

Partial Functions and Nontermination in The Hackett Guide has additional examples of partial functions.

A simple partial function that crashes the program with a message when evaluated.

2.6.1 Incomplete Programs


undefined! : (forall [a] a)

A partial value that crashes the program when evaluated.


(todo! form ...)

A form that expands to a partial value of type (forall [a] a) that crashes the program with a message containing its expected type when evaluated. Uses of this form serve as an indicator that a part of the program is not yet written. The forms provided to todo! are ignored, allowing the contents to contain not-yet-working sketches and notes.

> (not (todo!))

eval:2.0: todo! with type Bool

> (+ 42 (todo!))

eval:3.0: todo! with type Integer

> (+ 42 ((todo!) "hello"))

eval:4.0: todo! with type (-> String Integer)

Additionally, todo! attaches a syntax property containing its expected type to its expansion to cooperate with editors that know how to display that information. See the Todo List for DrRacket documentation for more details.