[racket] cond else and

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Wed Dec 12 06:42:49 EST 2012

> 2012/12/12 Frank Weytjens <fweytjens.android at gmail.com> wrote:
>> (define (draw-shapes a-posn a-lon)
>>  (cond
>>    [(empty? a-lon) true]
>>    [else (and (draw-circle a-posn (first a-lon))
>>               (draw-shapes a-posn (rest a-lon)))]))
>> ...

Jens Axel Søgaard replied:

> In the teaching languages only one expression is allowed after the else.
> If I remember correctly the Beginner languages does not include  begin
> so and is used instead.

Exactly.  However, we should also point out that most of us stopped using the "draw.ss" teachpack discussed in HtDP chapter 6 ten years ago, in part because of this uncomfortable confusion between imperative and functional programming.  Most of us have been using the functional "image" library instead.  For course materials built on this approach, see http://www.ccs.neu.edu/home/matthias/HtDP2e/ or http://picturing-programs.org .


Stephen Bloch
sbloch at adelphi.edu



Posted on the users mailing list.