[plt-scheme] Teaching Scheme

From: Karl Winterling (kwinterling at gmail.com)
Date: Mon May 3 18:56:19 EDT 2010

As someone who learned (R5RS-centric) Scheme as a "first language"
(whatever that means), I think I can comment about why using I/O for
teaching is "evil." A REPL is a _user interface_ for people using a
specific programming language that isn't necessarily restricted to
debugging. With a REPL interface, you only really need primitive I/O
when, for example, you need to write an interface that reads or writes
data to files on disk or TCP sockets (it's probably a bad idea for
event-driven code to directly use primitive I/O).

Part of this means that you can write a procedure and use it
immediately without having to worry about setting up an input port.
While this may not work well in certain situations, I think it's the
best way to teach beginners. Based on my experience as a lab tutor in
an introductory course, people with no prior programming experience
have few problems with the idea that every expression has a value.
It's completely natural for the computer to tell you the value of an
expression you type in and beginners shouldn't have to expect anything
else. After this, it's easy to explain side effects with something
interactive like turtle graphics or the SICP picture language, though
you should still focus on using procedures to return values suitable
for printing on the screen or passing to a primitive drawing procedure
(it's still possible to treat pictures as values, though).

People who already know a language like C or Java often feel that the
course doesn't meet their expectations, especially when some of them
realize that knowing, say, C# doesn't make you a good programmer.

As for applications, there are many high-quality Scheme
implementations that can be easily extended to support new language
constructs and arbitrary libraries in any language that can "behave
like" C. However, this isn't something that beginners need to worry
about, but you should mention that sometimes we want to add a new
"primitive" to the language. There are several examples of people
using Scheme in industry, all of which emphasize Scheme's flexibility
for supporting different problem domains. For example, Square USA used
Scheme in CGI rendering: http://practical-scheme.net/docs/ILC2002.html
People have even used Scheme for more ethically questionable purposes:
http://philosecurity.org/2009/01/12/interview-with-an-adware-author
(which might give you a chance to talk about ethical issues in
programming and engineering).

Your students, however, should be the ones answering the question
"What can Scheme do?" once they have enough exposure to program design
and low-level details. Hype never lasts.

---Karl


Posted on the users mailing list.