Wednesday, September 8, 2010

Daily, 2010/09/08: Whirlwind Start

I write "dailies" (but call them "post-mortems" in my head) after lecture, at least when I'm eating my spinach. These are records of how things went and where we stopped as well as aides to the TAs to track lecture.

This term, at a student's suggestion, I'll try posting these publicly (with my students as my explicit audience: "you"). I apologize in advance for self-censorship.

Announcement items:
  • Introductions: Steve and Dereck (Ben at tutorial)
  • Office hours
  • Extra office hours next week: see Vista announcements
  • Tutorial registration issue
  • Prereq letters
  • Your TODO items
    • Skim PLAI preface, READ PLAI prelude (Friday)
    • Install DrRacket on your computer (Friday)
    • Do Racket exercises 1-15 (website assignments page)
    • Skim/Read Scheme/Racket resources as needed
  • My philosophy on announcements
High-level comment:

I enjoyed the energy and hope that you did, too. I'm glad we made a hefty start on Racket. Oh, and I talked too fast. (Too excited to be back in the classroom after a summer recovering on my rocking chair.)


Details:



Today had four parts: (1) chatting about Steve's kidneys ('nuff said), (2) motivating the study of programming languages by looking at some language capabilities (qsort in Haskell example) and effective uses of languages (little languages paper examples), (3) chatting about Racket, and (4) learning Racket. We stopped (4) shortly after defining a skeleton sort function:

;; sort : (listof number) -> (listof number)
;; Consumes a list of numbers and generates a list containing the
;; same numbers, but in sorted order.
(define (sort lon)
  (if (empty? lon)
      empty
      ...))

(test (sort empty) empty)
(test (sort '(1)) '(1))
(test (sort '(3 2 4 1)) '(1 2 3 4))
(test (sort '(1 2 3)) '(1 2 3))

We'll continue and then move on to our first interpreter on Friday. (Emphatic note: you will not learn Racket by watching me type. Go try things!)

I'll add one surprise and one thought (that we won't revisit in class).

The surprise was questions about the relationship of 311 to 312. I might but did not anticipate this. 311 and 312 do discuss many of the same concepts (eager vs. lazy evaluation, first-class functions, polymorphic typing and unification). What's the difference?

Viewpoint. 312 views languages primarily from the programmer's side. 311 views them primarily from the designer's side. These lead to tremendous differences in details learned, but there will be plenty of overlap. To learn a language well in 312, you necessarily study the language's design (which is, in turn, a motivation for taking 311). On the other hand, a good language design accommodates and shapes the programmer's viewpoint.

Bottom line, there will be share concepts. Decide for yourself whether to revel in the synergy or disparage the overlap.

The thought I mentioned flows from this. Is syntax (and are all the other elements that go into a language besides semantics) important? Let's digress and then.. um.. {re,retro,in}gress.

The PLT group is largely behind (in the lurking, scheming, racketeering sense, but the good ones) the recasting of CPSC 311 and CPSC 111 (into CPSC 110) in the past few years. A valuable point they make about introducing programming is that we should leverage (high school) students' mathematical background. So, for example, one of our first programs in Racket was familiar to high school students, "one plus two": (+ 1 2).

So, why isn't that 1 + 2?

Well, it's just syntax. From a language design perspective, a picayune difference. But our high school student has trained for years to write 1 + 2, not (+ 1 2). So, in some sense, the argument about leveraging our programmers' experience still applies.

Syntax and other language elements matter to programmers. They are the human-language interface.

But, that's just a point, not the or even a core point of this course. I agree with Shriram that we should set it aside. Before doing so, I just wanted to give it a respectful wave.

Bye, syntax!

Cheers,

Steve

No comments:

Post a Comment