Using Scheme in the so-called real world?

This is a follow-up to yesterday’s post about replying to student questions concerning applicability of a math topic in the “real world.” At Weston we get a similar question with regard to our selection of Scheme as the Math Department’s programming language of choice in regular math classes and in Intro to Programming. There are admittedly extremely few commercial applications written in Scheme or closely related languages, and it’s unlikely that a student will find a summer job programming in Scheme. So why do we teach it?

As I type this, the very question looks odd to me. In an academic high school, we don’t teach what we teach because of its short-range utility in the world of employment. “Go to a vocational school for that,” we reply somewhat snobbily. But, just as I said yesterday in regard to logarithms, that answer is rightfully perceived as non-responsive. Among the real reasons we teach Scheme in a Math Department are the following:

  • It has almost no syntax rules. Basically, you’re thinking in algebra: the Scheme world consists primarily of functions and variables. The big ideas of inputs and outputs, domain and range, and composition of functions all flow automatically from working in this language.
  • The learning curve is very reasonable: in a very short amount of time, one can learn to write an interesting program.
  • Looping in Scheme is based on recursion.

But students still ask for real-world applications, since school is apparently not part of the real world (as I pointed out in yesterday’s post). Here are a few:

  • Continue (conference management software)
  • A bunch of games, packaged with DrScheme, which is the version we use at Weston
  • Margrave (a security policy analyzer)
  • MzTake (a debugger), about which Shriram Krishnamurthi comments as follows:

    (The only sensible thing to do when faced with a Java program is to switch to Scheme.) The Java debugger was selected as one of the award papers at a software engineering conference of people who have no affection for, and perhaps a slight antipathy to, Scheme. That’s because smart people recognize good ideas. You should ask your students how they fit that description. (-:

  • Abstrax (hard to describe, but definitely commercial: see their website)
  • See also Functional Programming in the Real World, for a list of more applications.

And here are some comments from a couple of leaders in computer science education, posted on a newsgroup that is relatively public, so I believe it’s OK for me to quote them.

From Boston:

I am sincerely sorry that my colleagues told you that Scheme is useful. I also won’t mention that Disney controls virtual rides with it, that the Air Force controls telescope batteries, that the Navy runs its weather service for all carrier borne jet fighters, that Motorola has an ordering system for packaging hardware, that .. oh, I didn’t mean to.

If your kids are so smart that they know now already what is useful and what’s not, you are wasting your time on them. Tell them to leave the class now. You don’t want to waste their time with stupid, useless, filthy parentheses.

P.S. Oh, and don’t tell them that with Scheme you can write a six line program and get a movie of a rocket launch in the very first lesson (instead of public static void(String argv[]) { System.out.println("hello world"); }), and everyone can understand it too. We wouldn’t want to keep them in class and waste valuable minutes on them.

;; Beginner, world.ss
(define (y-coordinate-for-rocket-at t) (- 300 (+ 20 10 (* 8 t))))
(define (create-picture t) (place-image 150 (y-coordinate-for-rocket-at t) (empty-scene 300 300)))
(define (tock t) (+ t 1))

;; run program run:
(big-bang 300 300 (/ 1.0 20) 0) ;; 20 frames per second
(on-redraw create-picture)
(on-tick-event tock)

The question has come up several times this semester and of course in years before. Here is how I really answer it:

“We have chosen the least popular programming language that we could find for this course. We believe that is also completely useless as a practical language and has no practical applications whatsoever. If you find one, please do not share this with the class or we have to look for an even more useless language.

Your first (and second and third) course in this beautiful subject should not be about a language, a sheer notation. Sure, you will need to master some of its vocabulary and grammar but the focus is on systematic problem solving. This is what you will take away from this course and it is something that you will remember for years to come. It will change your life. It’s more useful than mathematics in middle school and most high school grades. It’s as useful as English.

So hang in there and wait for a few weeks. If you find that this is challenging even though you know 2 or 3 programming languages already, that’s the intention. Because this is the pure essence of programming, unmarred by notation issues of whether ‘;’ is a separator or a terminator, of whether it’s object-oriented or class-based, etc.”

And from Waterloo (Ontario, not Belgium):

Scheme is a vehicle for ideas. My students in week 4 of a first-term, first-year course sail through concepts that students using Java in the mainstream courses are beating their heads against in week 6 of the next semester. I put bonus/challenge/enhancement materials on assignments in weeks 6 through 8 that provide simpler looks at topics with which students struggle in third- and fourth-year courses. The practical side of this is that Scheme is great for prototyping, getting a quick sense of whether an idea is feasible. There’s a response I sometimes give, along the lines of Matthias’s sarcasm but slightly more gentle, which goes like this: “Ever visit a gym? You were wasting your time. I’ve never seen a Nautilus machine or a treadmill outside a gym. Barbells — repeatedly lifting two balanced weights connected by a narrower piece of metal — completely contrived and artificial….”

While we can point to commercial systems that use Scheme, we cannot allow the debate to be framed in these terms. That is not the only metric, nor the most important one.



Categories: Teaching & Learning, Technology, Weston