COMP 302: Lecture 1 Course Overview and Introduction to SML Joshua - - PowerPoint PPT Presentation

comp 302 lecture 1 course overview and introduction to sml
SMART_READER_LITE
LIVE PREVIEW

COMP 302: Lecture 1 Course Overview and Introduction to SML Joshua - - PowerPoint PPT Presentation

COMP 302: Lecture 1 Course Overview and Introduction to SML Joshua Dunfield 4 January 2010 McGill University www.cs.mcgill.ca/ joshua/302 1 Overview COMP 302: Programming Languages and Paradigms . . . is not a trip to the


slide-1
SLIDE 1

COMP 302: Lecture 1 Course Overview and Introduction to SML

Joshua Dunfield

4 January 2010 McGill University

www.cs.mcgill.ca/∼joshua/302

1

slide-2
SLIDE 2

Overview

  • COMP 302: “Programming Languages and

Paradigms”

  • . . . is not a trip to the zoo
  • . . . is about thinking rigorously about

programming languages and programs

  • What does a program do? How do you know?

What does it mean?

  • How do you specify a programming language?
  • [How do you implement a programming

language?]

2

slide-3
SLIDE 3

Course Mechanics

  • Prerequisites: COMP 250 or COMP 203
  • If you have not taken either course,

talk to Liette Chin (Trottier 2070)

  • We have TAs
  • Your grade is 50% homework:
  • 5 assignments, mixing programming and

written questions

  • Midterm in class, worth 10%
  • Final worth 40%
  • You get two late days for homework

3

slide-4
SLIDE 4

Textbook

  • Robert Harper’s Programming in Standard ML
  • Download it from the course website
  • Also a version for printing 2-up
  • You will not need to print the whole thing

4

slide-5
SLIDE 5

Slide-Free Zone

  • This may be the last lecture with slides
  • Code and notes will be posted for many lectures
  • You are responsible for what is presented in lecture

5

slide-6
SLIDE 6

Don’t Copy Code

  • It is possible to design exam questions that are
  • moderately hard if you did the assignments
  • very hard if you didn’t
  • Copying is unfair to students who don’t
  • Copying is likely to be noticed
  • It’s against the rules

6

slide-7
SLIDE 7

Don’t Copy Code

  • If you’re worried that you will fail,

talk to us

  • I would rather give some big hints in office hours

than have anyone copy code

7

slide-8
SLIDE 8

Standard ML

  • High-level, functional, and statically typed
  • From the 1980s (revised 1997)
  • No, it is not widely used in the “real” world
  • Yes, you can get a job using functional languages

8

slide-9
SLIDE 9

History

  • PL/I was supposed to be huge

(“PL/I belongs more to the problem set than the solution set” —E. Dijkstra)

  • C++ was going to dominate forever
  • Java appeared

Moral: No one knows what languages will be popular in 10, 20, 30 years.

9

slide-10
SLIDE 10

Thinking on All Cylinders

  • “The tools we use have a profound (and devious!)

influence on our thinking habits, and, therefore, on

  • ur thinking abilities.” —E. Dijkstra
  • There is no more important tool when

programming

  • Even in Java or C++, it can be useful to “think in”

another language

10

slide-11
SLIDE 11

Values and Effects

  • SML is (primarily) a functional language
  • Evaluation, not execution
  • Values, not effects
  • Binding, not assignment

11

slide-12
SLIDE 12

Types

  • SML is statically typed
  • Types describe data:

integers, strings, lists of strings, lists of pairs of strings and integers, vectors, arrays. . .

12

slide-13
SLIDE 13

Types

  • SML is statically typed
  • Types describe data:

integers, strings, lists of strings, lists of pairs of strings and integers, vectors, arrays. . .

  • Types describe the behaviour of functions:

integers to integers, strings to integers, lists of things to lists of lists of things. . .

12

slide-14
SLIDE 14

Types

  • SML is statically typed
  • Types describe data:

integers, strings, lists of strings, lists of pairs of strings and integers, vectors, arrays. . .

  • Types describe the behaviour of functions:

integers to integers, strings to integers, lists of things to lists of lists of things. . .

  • Types are checked by the compiler
  • You’ll need to write types sometimes,

but SML will often figure them out

12

slide-15
SLIDE 15

Demo

[SML demo—basicSML.sml]

13

slide-16
SLIDE 16

First Assignment

  • Basic SML programming with lists and trees
  • Out Wednesday, Jan. 6 (we hope)
  • Due Wednesday, Jan. 20

14

slide-17
SLIDE 17

Zeroth “Assignment”

  • Get a CS account (if you don’t have one)
  • Get access to the SML of New Jersey compiler:

www.cs.mcgill.ca/~joshua/302/faq.php

  • Start reading Harper, chapter 2

15