Programming Languages (F28PL)

Course overview

Welcome to the Programming Languages 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 …”

Lecture times

- Thursday at 11:15 in JW2.
- Thursday at 13:15 in EM250 (lab).
- Thursday at 15:15 in JW1.
- Friday at 15: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

- The deadline for ML1 is 26 October 2018.

Coursework

There are three items of coursework: ML1, PY1, and PL1, as follows:
- ML1 coursework. Use this template to submit your answers. Version in Vision is definitive.
- PY1 coursework. Use this template to submit your answers. Version here is definitive.
- PL1 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 may still be 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 these exercises 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 and transcripts of lectures will go online as they are given. Thanks to Humaid for typing up the transcripts.

Lecture of Thursday 13 September at 11:15 (video) (transcript)
An introductory lecture. I warn that second year is harder than first year. I fire up PolyML.
Lecture of Thursday 13 September at 15:15 (video) (transcript)
More on PolyML.
Lecture of Friday 14 September at 15:15 (video) (transcript)
By this point we’ve done int, real, string, functions, polymorphism (both ad hoc and parametric), and we’ve touched on lists.
Lecture of Thursday 20 September at 11:15 (video) (transcript)
Lecture of Thursday 20 September at 15:15 (video) (transcript)
Lecture of Friday 21 September at 15:15 was a tutorial. There was no video.
Lecture of Thursday 27 September at 11:15 (video) (transcript)
Lecture of Thursday 27 September at 15:15 (video) (transcript)
Lecture of Friday 28 September at 15:15 (video) (transcript)
Lecture of Thursday 4 October at 11:15 (video) (transcript)
Lecture of Thursday 4 October at 15:15 (video) (transcript)
Lecture of Friday 5 October at 15:15 (video) (transcript)
Lecture of Thursday 11 October at 11:15 (video) (transcript)
Lecture of Thursday 11 October at 15:15 (video) (transcript)
Lecture of Friday 12 October at 15:15 (video) (transcript)
Lecture of Thursday 18 October at 11:15 (video) (transcript)
Lecture of Thursday 18 October at 15:15 (video) (transcript)
Lecture of Friday 19 October at 15:15 (video) (transcript)
Lecture of Thursday 25 October at 11:15 (video) (transcript)
Lecture of Thursday 25 October at 15:15 (video) (transcript)
Lecture of Friday 26 October at 15:15 (video)
Lecture of Thursday 1 November at 11:15 (video)
Lecture of Thursday 1 November at 15:15 (video)
Lecture of Friday 2 November at 15:15 (video)
Lecture of Thursday 8 November at 11:15 (video)
Lecture of Thursday 8 November at 15:15 (video)
Lecture of Thursday 15 November at 11:15 (video)
Lecture of Thursday 15 November at 15:15 (video)
Lecture of Friday 16 November at 15:15 (video)
Lecture of Thursday 22 November at 11:15 (video)
Lecture of Thursday 22 November at 15:15 (video)
Lecture of Friday 23 November at 15:15 (video)

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. They can also be played directly from inside VLC as → Media → Open Network Stream → Paste Video URL → OK.

See also
- course videos from 201617 and
- course videos from 201718 which include transcripts (thanks to Cameron).
- Prolog programs from lectures (html, pl files).

Local resources

- See Jack’s instructions on how to install Atom.
- See Tommy’s instructions on how to use the Windows Subsystem for Linux.
- See Stuart’s Youtube playlist on installing x2go, PuTTy, and WinSCP.
- See Stuart’s Youtube playlist on installing x2go, PuTTy, and WinSCP.
- See how to use linux screen which is a very useful utility.
- 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

Past exam papers:
- 201516
- 201617
- 201718

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).
- A web design exam, just for fun.

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

- Learn Prolog in Y minutes
- Learn Prolog Now
- 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)