This semester, I am teaching the undergraduate programming languages course at SJSU, a required course for CS majors. The course has two objectives:
The canonical way to meet these objectives is to teach Scheme, and to build
simple interpreters and compilers. It is not the most popular course. Most of
our students just don't think Scheme is all that cool. When I want them to
admire the elegance of closures and continuations, they are still hung up over
parentheses and let
.
This semester, I am trying something
new. I am using Scala as my functional language. The syntax is accessible to
the students (they all know Java), and they see Scala mentioned on dzone.com, so it isn't just something of interest
to a bunch of pointy-headed professors.
In the first few weeks, I am restricting myself to the functional subset of the language:
val
, not var
while
, just recursionhead
, tail
, and
::
List
class:
map
, filter
, /:
, etc.I can do exactly the same as in Scheme, except without the parentheses. Does it work? I had a few lectures, and here are my initial observations.
Program Files
, couldn't it at least add the bin
directory to the PATH
? It requires superhuman effort to get
the less talented students to edit the system configuration or to deal with
spaces in file names in the command shell.x : Int
instead of int x
, but one
quickly gets used to that. However, typing
append(lst : List[Any], a : Any) : List[Any]
into an interpreter window is no great joy. I expect this will get better when we move to Eclipse, where the IDE can take advantage of the strong typing.
Interested in following along? Click on the links of this schedule. There
are lab assignments in each lecture. If you need a hint with one of the labs,
leave a blog comment.