[plt-scheme] What are "and" and "or" ?

From: Marco Morazan (morazanm at gmail.com)
Date: Fri Feb 15 16:09:33 EST 2008

On Fri, Feb 15, 2008 at 2:19 PM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
>
> Marco, I have struggled with this issue for years. It would have been
> easy to add and& and or& primitives to the teaching languages for HtDP.
>
> But to what end?
>
> HtDP stands for two meta-guidelines on intro courses:
>
>  -- less is more, so make a small language for teaching
>     and don't hesitate to make it different from the real thing
>
>  -- there must be a straight path from teaching languages
>     to real ones.
>
> Consider and/or to be something that does just that. They
> must be there, and yet, there is no need to hide this ugliness
> of strict languages just so we can write
>
>  andmap l = foldl and true l
>
> and friends. Students need to know that the 'real' thing is
> ugly, no matter what.
>

I understand the trade-off. In fact, a little ugliness may be a very
good thing. After all, for most paradise must be lost.....eventually.
Some initial experience along that path may be good training.

Nonetheless, something fundamental has been lost here. Logical
functions are, after all, functions (from the perspective of a pure
mathematician and that is what students are calling me on). Functions
(that is all functions) ought to be first-class and they are not due
to the choice of making "logical primitive functions" special forms
forced by using short-cutting semantics to implement them. It seems to
me that we ought to be able to have "and" and "or" as primitives (not
special forms) and still use short-cutting to implement them. That, of
course, would change the semantics of Scheme.

Thank you for the responses. They have given me some ideas on how to
gently explain it to my beginning students.

Cheers,

Marco


Posted on the users mailing list.