Programming Languages 201718 (F28PL)

Course overview

Welcome to the Programming Languages 201718 webpage. In a nutshell, this course says:

“How should we program? Well, it matters what programs we have in mind. Let’s think this through …”

For historical reference.
See this year’s course.

Lecture times

- Thursday at 11:15 in JW2.
- Thursday at 13:15 in EM250 (lab).
- Friday at 09:15 in PG201.
- Friday at 13:15 in PGG01.

The rules:

  1. Attend lectures.
  2. Keep up with the course so you follow lectures. Research stuff on the internet.
    A student who thinks “I’ll sort it out during the holidays” is a student in denial (look at 1m03s).
  3. Rules 1-2 apply most especially to the student who thinks that rules 1-2 do not apply to them.
  4. Attend lectures.

Lecture slides

Here are slides:

- Lecture 1
- Lecture 2
- Lecture 3
- Lecture 4
- Lecture 5 – Python

The pdfs below were developed from the following older slides (l11 below corresponds to lecture-1 above):

l11.pdf l12.pdf l13.pdf l14.pdf l15.pdf l16.pdf l17.pdf l18.pdf l19.pdf l20.pdf

Deadlines

- Deadline for ML1 has passed.
- Deadline for PY1 was 19 November at 21:00 (passed).
- Deadline for PG1 is 1 December at 21:00.

Coursework

There are three items of coursework: ML1, PY1, and PR1.

So far:
- question ML1 exists and is in Vision.
- PY1 exists in and is below.
- PR1 exists in and is below.

For your convenience odt and pdf files for ML1 are here:
- ML1 coursework. Version in Vision is definitive.
- PY1 coursework. Use this template to submit your answers. Version here is definitive.
- PR1 coursework. Use this template to submit your answers. Version here is definitive.

Coursework is worth 30% of your mark, as per this webpage (so for instance, ML1 above is roughly a third of the total coursework and so worth roughly 10% of the total grade). The exam is worth 70% of your mark.

There are out-of-date versions of the course descriptor floating around stating that coursework is worth 40%. This is wrong. Don’t ask me to change the coursework weightings because a) I can’t and b) I wouldn’t anyway.

See last year’s coursework for routine exercises, and Tommy Lamb’s excellent answers.

See also Labs from 2014, – lab07.pdflab08.pdflab09.pdflab10.pdflab11.pdf – and tutorials – tut06.pdftut07.pdftut08.pdftut09.pdftut10.pdf – and a study class.

See also:

- How to answer a programming question.
- A poem.
- Some comments on how to answer the question.
- Ciaran Dunne’s answer to QI7.
- A one-hour Prolog tutorial.
- A short WatMan talk exploring the corner cases of various programming languages, in a similar spirit to some of our explorations of Python.
- Not a bad page discussing types in Python.

Lectures

Videos of lectures will go online as they are given. See also last year’s course videos. Many thanks to Cameron for making the transcripts below.

Lecture of Thursday 14 September at 13.15 (video) (transcript 1)
An introductory lecture. I warn that second year is harder than first year. I fire up PolyML.
Lecture of Friday 15 September at 09:15 (video) (transcript 2)
More on PolyML.
Lecture of Friday 15 September at 13:15 (video) (transcript 3)
By this point we’ve done int, real, string, functions, polymorphism (both ad hoc and parametric), and we’ve touched on lists.
Lecture of Friday 22 September at 09:15 (video) (transcript 4)
Discussion of declarative vs imperative programming.
Lecture of Friday 22 September at 13:15 (video) (transcript 5)
Lists, recursion, tail recursion.
Lecture of Thursday 28 September at 11:15 (video) (transcript 6)
More on ML.
Lecture of Friday 29 September at 09:15 (video) (transcript 7)
Discussion of how to answer programming questions.
Lecture of Friday 29 September at 13:15 (video) (transcript 8)
More on ML, including exceptions.
Lecture of Thursday 5 October at 11:15 (video) (transcript 9; includes also ML code from lecture 11)
Exceptions and global variables in ML, discussion of to what extend ML is functional.
Lecture of Friday 6 October at 09:15 (video)
We start on Python.
Lecture of Friday 6 October at 13:15 (video)
Discussion of how to unwrap ‘wrapper functions’ from datatypes in ML; binary tree sum example. Then back to Python, exploring arithmetic.
Lecture of Thursday 12 October at 11:15 (video)
Lecture of Friday 13 October at 09:15 (video) (transcript)
Lecture of Friday 13 October at 13:15 (video) (transcript)
Lecture of Thursday 19 October at 11:15 (video) (transcript)
Lecture of Friday 20 October at 09:15 (video) (transcript)
Lecture of Friday 20 October at 13:15 (video) (transcript)
Lecture of Friday 27 October at 09:15 (video) (transcript)
Lecture of Friday 27 October at 13:15 (video) (transcript)
Lecture of Thursday 2 November at 11:15 (video) (transcript)
Lecture of Friday 3 November at 09:15 (video) (transcript)
We start on Prolog. The databases I use are here available as html and pl files.
Lecture of Friday 3 November at 13:15 (video) (transcript)
Lecture of Thursday 9 November at 11:15 (video) (transcript)
Lecture of Friday 10 November at 09:15 (video)
Alexander Johnstone’s talk. Thank you Alex.
Lecture of Friday 10 November at 13:15 (video) (transcript)
Lecture of Thursday 16 November at 11:15 (video)
Lecture of Friday 17 November at 09:15 (video)
Lecture of Friday 17 November at 13:15
I dispense dodgy life advice. For your health and safety the video is not publicly available.
Lecture of Friday 17 November at 14:15 (video)
Allan Jardine’s excellent talk (organised by Santiago Chumbe as part of the Web Design and Databases course).

To watch the files above, you may need to download then locally (right-click save, then open). Just left-clicking on the link may not work.

See also
- lectures from last year,
- Prolog programs from lectures (html, pl files).

rlwrap

rlwrap gives BASH-style history and completion at the command line. If you don’t know what that means then trust me—-you want this.

Run SML, PolyML, Python 3, and SWI Prolog by respectively typing

rlwrap sml
rlwrap poly
rlwrap python3
rlwrap swipl

The exam

A mock paper is available in two flavours:
- Without solutions.
- With solutions.
Attempt the one without solutions first.

Also:

In addition:
- These Chuck Norris facts will be examinable.
- So will all 93 of these rules of cycling (my personal favourites: rules 9, 12, and 14).

Interesting webpages

You may like:
- Hans-Wolfgang’s course F21SC on Industrial Programming which covers C-sharp and Python.
- This list of ten reasons not to use a functional programming language. (The ‘not’ here is ironic.)
- A Wired article about functional programming (Erlang and Haskell) being used by WhatsApp and Facebook. A worthwhile read.
- A rather beautiful article by Paul Graham about functional programming (Lisp) used in a startup. Also a very worthwhile read.
- If you liked Paul Graham’s essays, you could also look at The hundred-year language and Revenge of the nerds.
- A one-page SML crib sheet. Very helpful.
- A BBC podcast on Grace Hopper’s creation of compilers.
- Another BBC podcast on robots and their effect on jobs.

Course resources

- Rosetta code is worth at least one visit, and not just because you’re doing F28PL.
- A Python visualiser. Or jump straight in.

Local stuff

- Lecture videos.
- Lecture slides.
- Tutorials.
- Labs.

ML

- Study class 1.
- Example SML programs (from a previous year, but still useful), and also
- The standard SML basis library. A useful read to explore built-in functions.
- A one-page SML crib sheet. Very helpful.
- These ML lecture notes from the University of Washington are succinct and very clear.

Python

There’s some really really good stuff online, including:
- Learn python the hard way.
- Learning Python.
- This online Python course, in particular the page on recursion.

Prolog

- Example Prolog programs.
- Bill Wilson’s Prolog dictionary.
- The Prolog tutorial by Paul Brna and Tamsin Treasure-Jones dates back to 1996 and is still great.
- Lydia Sinapova’s Prolog Class Notes.

Required reading

You are required to read the following short essays, which discuss imperative programming (represented by C, Pascal, and Java), functional programming (represented in the essays by Lisp and in this course by ML), and logic programming (represented by Prolog).
I may base a discussion question in the exam on material from these essays.

  1. Beating the averages,
  2. The hundred-year language, and
  3. Revenge of the nerds.

A bit about me

I am a researcher in theoretical computer science. My research is mostly in formal logic.
Everybody calls me Jamie but my name is actually Murdoch. You can contact me by e-mail on “gabbay at macs hw ac don’ttypethis uk”. My office is G.50 Earl Mountbatten Building.

The students

Ah, well. I’m glad you asked. You should be second year undergraduate students. Let me know if this is not the case; I’d be interested to know!

A propos nothing in particular

- Revised log levels proposal: “FYI” “WTF” and “OMG” (John Barnette)