25
$\begingroup$

When I started my Computer Science studies, Scheme was the first thing we learned in our first programming course. Almost 8 years later, I ask a friend of mine, and it seems that they are still teaching Scheme for beginners. Besides the annoying amount of parenthesis, I found Scheme helpful, and I was able to understand important concepts as how interpreted languages work, anonymous functions, recursion and so on.

My question comes, because, except for that semester, I have never used Scheme again, and even though it was helpful I have always thought why not teach another real world use language.

Wouldn't, for example, Python help in the same way? Why Scheme?

$\endgroup$
10
  • $\begingroup$ For new learners it is better nowadays to call it Racket, solving an old communication problem. Scheme is the ancestor and was generally associated to one perspective (R5RS). Racket supports this, R6RS and the latest developments from the PLT team. $\endgroup$
    – Armfoot
    Commented Sep 4, 2017 at 14:14
  • $\begingroup$ @Armfoot I don't know about other universities, but Berkeley uses it's own scheme, which is distinct from racket. $\endgroup$
    – k_g
    Commented Sep 4, 2017 at 19:26
  • $\begingroup$ @k_g interesting, I thought that Scheme implementations used in schools were derived from the PLT group. Did Berkeley implement their version from a particular standard/perspective (RnRS)? $\endgroup$
    – Armfoot
    Commented Sep 4, 2017 at 21:12
  • 3
    $\begingroup$ Creating a level playing field and forcing people to think differently. Too many kids show up knowing one curly-brace language or another and thinking that's all they ever need know. $\endgroup$ Commented Sep 4, 2017 at 21:21
  • 1
    $\begingroup$ Interestingly, I think MIT switched a few years ago from Scheme to Python in the first programming class in course 6. $\endgroup$
    – Barmar
    Commented Sep 5, 2017 at 12:51

11 Answers 11

36
$\begingroup$

I think that the purpose of such a course is not to teach you a language. After all, Scheme, with its abstract syntax, is pretty minimal as a language. The purpose of a course like that is to teach you to think abstractly. If you can do that now, several years later, you can probably thank the course for getting you started. Abstraction, after all, is the big idea about computer languages.

A course in Python or another language can do similar things, but not in quite the same way, since in those languages you also need to learn the language syntax, idioms, and other structures. Scheme pushes all that aside for the opportunity to focus on abstraction. The things that are not in the language make it easier to focus on the big ideas.


This isn't really related to your question, but I note that many language designers start out with a lisp- (scheme-) like syntax to try out ideas in the language before they think very hard about its concrete syntax. It turns out to be very good for such experimentation.

$\endgroup$
0
25
$\begingroup$

There's one more reason I'd like to add to those here, less high-minded, but also a genuine consideration. One of the practical difficulties of teaching an introductory course is that the students come in at vastly different levels. Some are quite competent already and some are brand new. It is rare for kids to come in with any experience outside of imperative languages, though.

By utilizing a functional language in your first course, you get to have a classroom full of kids who have more similar footing. And when you move on later to imperative programming, you no longer have any kids with no experience. It's a simple trick to keep your cohorts more on-level without wasting the time of the advanced students.

$\endgroup$
17
$\begingroup$

Every second you spend explaining a programming language is a second you are not teaching programming, software development, software engineering, software design, or computer science.

You can teach the entirety of Scheme in a single lesson. You can probably teach the entirety of Scheme in 10 minutes. Python is significantly more complex than Scheme, so, you will spend significantly more time explaining Python and not teaching CS.

Oh, and BTW: the world's most widely-deployed programming language is essentially Scheme with syntax. (And an object system inspired by NewtonScript, Act-1, and Self.) Personally, I didn't understand ECMAScript until I learned Scheme and Self. Teaching Scheme will get your students halfway there. So, in that sense, Scheme is one of the most "real world" languages out there.

$\endgroup$
7
  • 1
    $\begingroup$ Perhaps I'm corrupted by already knowing programming languages that are so different from Scheme, but I've been poking at Scheme for quite some time now, and still don't feel like I understand it. The closest thing I've found to "learn Scheme in 10 minutes" is this: web-artanis.com/scheme.html. I've also read Norvig's claims that he could do in 3 days what it took his Java competitors 30 days to do. I'd love to have that kind of productivity spike, but I remain skeptical. $\endgroup$ Commented Sep 4, 2017 at 2:07
  • 1
    $\begingroup$ Scheme, therefore, remains one of those simple, elegant tools that can be compared to a surgeon's scalpel: powerful, but taking years to master. Most people apparently don't have that kind of patience, as evidenced by the ubiquity of curly-brace languages and the ongoing obscurity of s-expressions. $\endgroup$ Commented Sep 4, 2017 at 2:14
  • 1
    $\begingroup$ @RobertHarvey but then when pushed, Peter Norvig moved to Python: news.ycombinator.com/item?id=1803815. Said 10x productivity boost has there become "has the edge". And, presumably, not enough edge to bring Google to LISP. $\endgroup$ Commented Sep 5, 2017 at 8:04
  • 1
    $\begingroup$ Scheme's grammar is easier to specify to yacc than that of Python (it's probably simpler to just write a Scheme parser freehand), but where's the need to hyper-optimize an operation that happens once per compiler? The popularity of curly-brace languages and the ubiquity of byzantine natural-language grammars suggests that learning silly arbitrary grammar rules is massively cheaper for our brains than specifying those rules in BNF. That's not to say there isn't value in kids learning Scheme, of course. Just not because it's "easy to learn". $\endgroup$ Commented Sep 5, 2017 at 15:01
  • 1
    $\begingroup$ @pojo-guy: I am willing to bet there are more deployed JavaScript runtimes in the world than there are COBOL runtimes. For example, in my (tiny) flat, there are over 20 JavaScript runtimes (7 on my laptop alone), and 0 COBOL runtimes. Almost every adult in the (so-called) developed world is carrying at least one in their pocket. $\endgroup$ Commented Apr 14, 2018 at 20:58
15
$\begingroup$

With Scheme, you start teaching programming concepts on day 1 - and also implementing them as working code on day 1.

With a typical procedural language (C++, Java, etc) you first have to crawl through the swamp formed around 20+ years of accumulated obsolescent and deprecated syntax. The survivors from that experience might get to learn some concepts eventually, but only if the course doesn't run out of time first!

Recent languages like Python have the great educational disadvantage of features like duck-typing, etc. Of course that makes them very effective tools in the hands of good programmers, but not so effective as teaching languages it's too easy to make subtle mistakes. (And don't even mention the mess that Python got itself into over syntax changes in the upgrade from Python 2 to Python 3...)

$\endgroup$
3
  • 1
    $\begingroup$ Woah. Maybe a bit overstated. A couple of teaspoon fulls maybe. But yeah. It explains why those other languages require more pedagogy and support, most likely. $\endgroup$
    – Buffy
    Commented Sep 2, 2017 at 20:49
  • $\begingroup$ Why would Python change the meaning of 5/2 or make print "a" an invalid syntax, I can't understand. But at least it's not like Swift which has many breaking changes in every subversion... $\endgroup$
    – EralpB
    Commented Sep 5, 2017 at 7:14
  • 2
    $\begingroup$ "Recent languages like Python" in contrast to languages like C++, Java, is a bit confusing. Python was first published 1991, a quarter century ago. Java 1995. C++ was standardized 1998 (though dating back to 1979). $\endgroup$ Commented Sep 5, 2017 at 11:56
12
$\begingroup$

Simplicity

You can write the definition of scheme on the back of a postage stamp. Therefore as @Buffy says, you don't have to learn the language at the same time as learning the concepts.

It is a pure functional language.

You will be a better programmer, because you learnt functional. Better to do it first, few people learn functional second.

Education vs training

Education is about learning the concepts, training is about leaning a language. Education is long term, training is short term. Training is about learning, Education is about learning how to learn (meta learning).

A personal experience

I leant scheme late, after basic,pascal,C,C++,C#,python,tcl, et al. I have never done it again, but I have not stopped using it, in the way I program in other languages.

$\endgroup$
3
  • 7
    $\begingroup$ Scheme is not a pure functional language. $\endgroup$ Commented Sep 3, 2017 at 6:31
  • $\begingroup$ That depends on the Scheme. $\endgroup$
    – Racheet
    Commented Sep 3, 2017 at 12:09
  • $\begingroup$ @Derek it was originally, but some variants add mutation. Thing is you don't need much to implement mutation, just the basic building block. Therefore functional programming is a state of mind. The best way to get this state of mind is to learn a pure functional language such as scheme. And then add mutation your self, when and only when you need it. $\endgroup$ Commented Sep 3, 2017 at 12:31
10
$\begingroup$

Scheme is not that widely used in the industry, but that is not the point. The purpose of CS is not to teach you any particular language, but to teach fundamental concepts. When you know the fundamental concepts, learning any particular language is pretty easy. Anybody with a solid CS background would be able to learn Python in a few hours of self-study.

Scheme is well-suited to teach fundamental concepts for a few reasons:

  • Built on very simple and logical concepts.
  • Syntax may be unconventional and somewhat tedious, but it is also totally logical and consistent, which means you don't waste a lot of time on surface issues.
  • Extremely flexible which means you can implement almost any CS concept and paradigm in it.

You can consider scheme more of a "blank slate" than Python. For example the SICP book teaches object oriented programming by having the student implement an object system from scratch in Scheme. Now in industry you might prefer a language which already have a solid built-in object system (like Python), but for teaching it gives a much deeper understanding to implement one yourself.

$\endgroup$
1
  • $\begingroup$ Also you have macros. This is similar to pointers in that the concept is hard to wrap your mind around. "Now it is data, now it is code, now it is data again". Very few languages get this. $\endgroup$ Commented Sep 8, 2017 at 16:25
5
$\begingroup$

Procedural approach. Not a joke: with functional programming students are very quickly faced with the necessity to write their code as a set a (reusable) functions with a clearly defined role.

With the traditional approach of imperative/OO languages, they learn functions after a lot of other concepts : loops, arrays, etc. Probably too late.

For example: if you ask them a program to compare the average value of an array, a lot of them will write a loop to sum the values, not use a function for the sum of the array. Even if it was a previous exercice.

$\endgroup$
7
  • 1
    $\begingroup$ “Procedural approach”? $\endgroup$ Commented Sep 2, 2017 at 18:51
  • $\begingroup$ @ctre-alt-delor Imperative approach: a program is seen as a "sequence" (maybe structured) of actions. Procedural: relies on procedures (functions, subroutines, whatever) for the division of work. $\endgroup$ Commented Sep 2, 2017 at 20:26
  • 2
    $\begingroup$ @MichelBillaud Procedural does not mean the same as functional. It usually refers to structured imperative programming. $\endgroup$
    – Bergi
    Commented Sep 2, 2017 at 21:31
  • 1
    $\begingroup$ Procedural is imperative, functional can be imperative, imperative can and should be structured, however functional ≠ procedural. Procedural is about doing and side-effects, functional is about return values. Both use subroutines. $\endgroup$ Commented Sep 3, 2017 at 12:17
  • 1
    $\begingroup$ @Bergi Notice that the answers says "Procedural apporoach", not "Procedural programming". The approach to teaching in functional languages is to reduce tasks until each subtask is a single function. That process is a procedural approach to the task, while not being procedural programming. Let's not argue with terms and definitions when discussing concepts to begin with. $\endgroup$ Commented Sep 4, 2017 at 2:38
3
$\begingroup$

There are some great answers here already, but I have one thing that was not said yet directly:

Forcing students to learn a second language before proceeding further

I strongly believe that knowing multiple languages is crucial for proper programmer development. Every language has it's own ways of modelling reality, and devs using (even worse: knowing) only one language get very strongly tied to it's idioms and quirks. Offering Scheme as the first language should force students to learn something more practical (no offense) quickly, giving them grasp of 2 significantly different approaches, and more or less untie their abstract thinking from any specific language.

$\endgroup$
3
  • 2
    $\begingroup$ Long ago, I enrolled in a "Comparative Programming Langauges" class that required me to write at least one program in each of; Pascal, Lisp, SNOBOL, Prolog, Forth, and OPS5. Even if I never had used any of those languages in a paying job, I still would have ranked that class among the most important that I ever attended. $\endgroup$ Commented Apr 14, 2018 at 17:05
  • 3
    $\begingroup$ In the University I graduated from, the bachelor CS studies (3 years) required people to submit code in about 8-10 languages, including Haskell and Prolog (+ stuff like html and sql). For me it was one of the best things there, though pretty tough for some. $\endgroup$
    – Frax
    Commented Apr 14, 2018 at 17:34
  • 1
    $\begingroup$ Very much this. Back in school (1980s) the CS curriculum started using Pascal, and to acquaint ourselves with a completely different programming paradigm, we had to chose either Common Lisp or Prolog. I chose Common Lisp, and it was instrumental in drastically expanding my computational thought process (and was a lot of fun to boot). I never used Lisp in a professional capacity later other than for some Emacs customization. I also took a "Comparative Programming Languages" class, but it didn't require submitting code, so had much less of an impact. $\endgroup$
    – njuffa
    Commented Apr 15, 2018 at 2:05
2
$\begingroup$

With many programming languages, you don't see the computer's view of your input: the tokenized form, the parse trees. All those are part of a computer language's universe and are kept out of the programmer's hands and access.

In Scheme, your input is the parse tree. That puts you more level with the computer than many other languages. In some manner, Scheme does not even have a programming language rather than just a convenient way to enter parse trees.

In contrast, the distinction (or at least its naming) procedural/functional is sort of a red herring: the programming style employed in Scheme quite often is rather procedural, doing one action after another.

$\endgroup$
2
$\begingroup$

user2892 mentioned the book SICP (Structure and Interpretation of Computer Programs). This book alone is enough of a reason to justify Scheme as a major contender for an introduction to computer science class. This book is a must-read for anyone truly into computer science. See Brian Harvey's essay...

Brian Harvey: "In 2011, to celebrate the 150th anniversary of MIT, the Boston Globe made a list of the most important innovations developed there. They asked me to explain the importance of SICP, and this is what I sent them:"

https://people.eecs.berkeley.edu/~bh/sicp.html

$\endgroup$
3
  • $\begingroup$ Hey, thanks, this is good material. However, you didn´t answer my question :D Could you extract what you think is most important in the sources you mentioned so the question can be answered? That would be great. $\endgroup$ Commented Sep 6, 2017 at 16:54
  • 1
    $\begingroup$ Thanks for posting about my favorite CS book, and welcome to CSE Stack Exchange! Answers are supposed to be self-contained, so could you please summarize why SICP rocks? $\endgroup$ Commented Sep 6, 2017 at 19:14
  • 1
    $\begingroup$ I'm sorry, I thought I added one reason for using Scheme - that one of the best introductory computer science textbooks is based on Scheme. Other major reasons for using Scheme as an introductory language have already been presented in answers provided prior to my note, e.g., its syntax simplicity and its emphasis on data and procedural abstraction. I believe that one should use a language best suited to introducing computer science/programming in an introductory class. Students can learn other languages in common use in follow-on classes. $\endgroup$
    – gmh
    Commented Sep 7, 2017 at 17:25
-2
$\begingroup$

We don't have Scheme in our entire country (here in India) but that honour goes to C programming language.

For the purpose of my answer, substituting C for Scheme, I keep asking myself, why bother with C. After that 1 semester of C, I have never used C professionally anywhere. In fact, once I step out of educational purposes, C becomes useless. That begs the question, after almost 25 years, why are they still teaching C? Why not something else?

I think, why they are still teaching C (in my country) and Scheme (in yours) is probably because it is ubiquitous. there are any number of books written on C. More importantly, the faculties who teach them ( I think most faculties change their jobs once in 60 years) can teach the same thing for the rest of their lives, use the same lab manual, and use the same code, and ask the same questions, use the same evaluations. From a strictly logistical point of view, it makes sense to teach C 30 years ago, and 30 years hence.

Can you image the mess, if every five years, the universities change their syllabus? Thats a logistical nightmare (not to forget other challenges) no one wants to deal with. For instance, one university could decide to go with C sharp, and another with Java. That creates all kind of problems. However, if all universities agree (which is how things are now) to simply keep using Scheme (in your case) and C (in my case), life becomes simple.

Further, the foundation that you get by learning an ancient language is that, everything that came after it, be default, would be easier. I learnt to ride a bike (as in motorcycle, not bicycle) in my dads old bike which was, well not that good. However, because I drove the tough one, all of today's bikes seem like child's play. Although I don't use C itself, anytime I learn a new language, I unconsciously compare it to C, and learn from that.

Update 1 : To add some context, I have been part of the IT industry for 11 years, and 5 of them as a developer/trainer/educator who travels widely. I am sure C is used somewhere, I haven't seen one single enterprise usage of C and I have worked for startups, small companies (less than 100 employees) and for MNCs (more than 2000 employees) and never ever has any division, anywhere talked about C, used C or implemented C.

Again, no disrespect to C (or its legion of fans) but I request that my opinion be taken in this context.

$\endgroup$
10
  • $\begingroup$ I don't think you can compare Scheme and C in this way. C is used out there in real world projects. Operating systems and hardware related stuff is still a domain for C programmers. There is much less Scheme outside of education. $\endgroup$
    – BlackJack
    Commented Sep 3, 2017 at 16:43
  • $\begingroup$ There are enough uses for Scheme et al in an educational context to avoid assuming this rather sarcastic viewpoint... $\endgroup$
    – AnoE
    Commented Sep 3, 2017 at 18:19
  • 1
    $\begingroup$ Your reasoning is flawed. You are likely correct that teaching C is mainly due to inertia preventing a switch to something more modern. C has little to recommend it for the purpose of teaching program except that at one point in time it was the most popular language around. Neither of these is true for Scheme. $\endgroup$
    – Jules
    Commented Sep 4, 2017 at 11:53
  • 2
    $\begingroup$ Then, Scheme has my compliments that it does not have any of the baggage that C has. Further, I hope that someday, the universities here in India will adopt Scheme so the youth in India can also benefit from it. You know, prosperity for everyone :) $\endgroup$
    – Jay
    Commented Sep 4, 2017 at 12:07
  • 2
    $\begingroup$ Re, "We don't have Scheme in our entire country." Nobody?... in all of India?... has ever downloaded a copy? Well hey! That means you can be the first: gnu.org/software/mit-scheme $\endgroup$ Commented Apr 14, 2018 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.