The Scheme convention for absence of a value, inherited by Racket, is to use #f since it is the only falsy value. This make it easy to branch on the presence or absence of a value.
Typed Racket reinforces this convention: it has an (Option t) type constructor that is an alias for (U t #f), which is a union of `t` and the singleton type for the #f value. This cooperates well with Typed Racket’s occurrence typing so code that branches on the presence of a value properly typechecks. > On Oct 11, 2015, at 10:22 PM, Byron Davies <[email protected]> wrote: > > In my state object for 2htdp, I have entries that are normally natural > numbers. When the value of a particular entry is not meaningful during a > certain activity, I could just leave the value as whatever it was before, but > I would prefer to set it to an invalid value (such as -1 or #f) to indicate > that it’s not being used. Is there any stylistic reason to prefer one over > the other, and will the answer be different when I use Typed Racket? > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

