comp 302 lecture 1 course overview and introduction to sml
play

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


  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

  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

  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

  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

  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

  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

  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

  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

  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

  10. Thinking on All Cylinders • “The tools we use have a profound (and devious!) influence on our thinking habits, and, therefore, on our 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

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

  12. Types • SML is statically typed • Types describe data: integers, strings, lists of strings, lists of pairs of strings and integers, vectors, arrays. . . 12

  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

  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

  15. Demo [SML demo— basicSML.sml ] 13

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

  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

Recommend


More recommend