True and false which one?

In Racket is possible to write #t #T #true true and #f #F #false false.

Which one do you prefer?

I prefer #true and #false.

I am similarly in the #true and #false camp. I often find that the layout of the code is more salient with slightly longer atoms like these; especially a trailing else. The short names cause me to "miss" them somewhat.

2 Likes

t and nil :grin:

(In the R2RS days of scheme, #!true and #!false were used. That was dropped in R3RS.)

2 Likes

#t and #f seem to be by far the most idiomatic, and they're also used in the Racket documentation. Therefore, I use them, too.

If it wasn't for the widespread use, I'd probably go with #true and #false, since otherwise they're clearer. Regarding the use of lowercase, it's the norm for symbol literals and identifiers.

3 Likes

Likewise, I usually use #t and #f per convention, but do I sometimes use #true and #false to be extra explicit.

In particular, in prose, I've started writing e.g.:

is provided and non-@racket[#false], then

because it seems more readable that non-@racket[#f].

When choosing a font for Racket code, it is particularly important that t and f look distinct.

2 Likes