On May 30, 2011, at 2:25 PM, Ian Barland wrote:

>> forbid one-armed if statements; they are always a source of trouble.
>> 
> FWIW, this link appeals to some students, about the perils of one-armed-if:
> 
> http://www.zuneboards.com/forums/zune-news/38143-cause-zune-30-leapyear-problem-isolated.html
> 
> --Ian

I see a more important message in that example:

Those who claim that functional programming is hard to read, often write code 
as in that example (I am a veteran of that sort of programming; I can't be the 
only one.) Even though it is supposedly easy to read, it is not easy to discern 
that it is wrong. An HtDP solution would more likely describe the data first 
(days are less than 366, equal to 366, or greater than 366). One cond would 
handle all three, two would terminate, and the the last would continue the 
accumulation. 

In other words, the possibility of that hard-to-read bug doesn't exist.

rac



> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users


_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to