Programming Languages Rhys Price Jones Class home page is linked from: http://www.seas.gwu.edu/~rhyspj

Friday, December 31, 2010 CSCI 3221 Programming Languages Rhys Price Jones Class home page is linked from: http://www.seas.gwu.edu/~rhyspj

Friday, December 31, 2010 Textbooks:

 Little Schemer  absolutely essential to read and write (!) this book this week  SICP  Structure and Interpretation of Computer Programs  a timeless classic  buy the paper book, or use the online free version

2

Friday, December 31, 2010 Software - free downloads:

 Petite chez scheme  http://www.scheme.com  emacs  www.gnu.org/software/emacs  You can plug in stuff to Eclipse so it supports scheme  but my class presentations and materials will be emacs based

3

Friday, December 31, 2010 Platform specifics

 Windows  nice to have cygwin  www.cygwin.com  Mac  all set to go BUT do not use the Emacs that comes with mac os.  Linux ...

4

Friday, December 31, 2010 Exams etc

 One midterm  One final  more or less weekly  quizzes  reading assignments  lab assignments

5

Friday, December 31, 2010 Overview of course

 Learn Scheme  Use Scheme  Ignore Scheme  and concentrate on principles of computation  Implement Scheme  Modify Scheme  Implement other languages

 and experiment with language features 6

Friday, December 31, 2010 Reading assignment

 linked from class home page  This first week. Little Schemer  Chapter 1  Chapter 2  Chapter 3  Chapter 4  Chapter 5

 7

Friday, December 31, 2010 This week’s lab

 play with scheme  What is Scheme?  a dialect of Lisp  What is Lisp?  ...

8

Friday, December 31, 2010 Lisp

 List Processing Language  The “medium of choice for people who enjoy free style and flexibility”  Gerald Sussman  Invented by John McCarthy  1956 Dartmouth Summer Research Project on AI

9

Friday, December 31, 2010 Myths about Lisp

 Lots of Irritating Stupid Parentheses  Fussy syntax  Slow  Difficult

 Abstruse ab·struse Etymology: Latin abstrusus, from past participle of abstrudere to conceal, from abs-, ab- + trudere to push : difficult to comprehend : re c o ndit e

10

Friday, December 31, 2010 Scheme

 a “dialect” of Lisp  small  very close to Lambda Calculus  well defined semantics  widely available

11

Friday, December 31, 2010 How to Program in Scheme

 Start it up:  type petite in unix shell  you’re in an interactive environment  whatever you type is a program and gets evaluated  My favorite program  2  Another program  (+ 2 2) 12 Friday, December 31, 2010 Scheme knows numbers

 Try the programs  42  2/4  1.36  -2.0+3i  2/4+3/6i  There is a domain of numbers  do they mean anything?

13

Friday, December 31, 2010 Scheme knows some operations

 Try the programs  (/ 15 6)  (quotient 15 6)  (* 3+2i 3-2i)  (/ 1 (- 1 (+ (/ 2.0 3) (/ 1.0 3))))  (/ 42 0)  There are operations defined on the domain of numbers  Do they mean anything? 14 Friday, December 31, 2010 Do they?

 Try the programs  /  quotient  sqrt  integer?  rational?  Our domain has numbers and procedures  Do they mean anything? 15 Friday, December 31, 2010 Does it matter?

 Does it matter if numbers and operations mean anything?  In the real world  yes  In this course  no!  you’re in a world of your own

www.theflooringcompany.com16

Friday, December 31, 2010 17 www.quackometer.net/.../ humpty-dumpty-795696.gif Friday, December 31, 2010 That’s where we’re going!

 The computer will be exactly what we intend  No more -- no less  We are in control  Because we understand semantics!

18 flickr.com/photos/ bobbdobbs/2602758639/ Friday, December 31, 2010