[racket] static variables question

From: Stephen Bloch (bloch at adelphi.edu)
Date: Sat Feb 18 21:02:41 EST 2012

On Feb 18, 2012, at 2:42 PM, Gary Baumgartner wrote:

>>       (filter (lambda (v) (if (and (>= v start) (<= v end)) #t #f))
>>   storedlst)
>>       )))
> [...]
> Consider just (lambda (v) (and (>= v start) (<= v end))) --- no 'if'.

I see a lot of my students doing this -- in whatever language -- because they think of Booleans as a way to decide which of two things to DO, rather than as legitimate values in their own right.  In fact, the whole world of expressions is a bit of a foreign country -- a sort of "adjunct" to the more-legitimate world of statements.

if (blah == true) {
   return true;
else {
  return false;

For those of us forced to teach in Java, CheckStyle has two modules, SimplifyBooleanExpression and SimplifyBooleanReturn, that catch things like this.

Stephen Bloch
sbloch at adelphi.edu

Posted on the users mailing list.