DOC PREVIEW
UW CSE 341 - Lecture Notes

This preview shows page 1-2-3-4-5 out of 16 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

'&$%CSE 341:Programming LanguagesHal PerkinsWinter 2006Lecture 1— Course IntroductionCSE341 Winter 2006, Lecture 1 1'&$%Welcome!We have (not quite) 10 weeks to learn different paradigms andfundamental concepts of programming languages.With diligence, patience, and an open mind, this course makes you amuch better programmer (in languages we won’t use).Today in class:• Course mechanics• Course overview and a rain-check on motivation• Dive into ML (homework 1 due next week)CSE341 Winter 2006, Lecture 1 2'&$%CreditsThis version of the course is based on the one created by DanGrossman in 2004, and taught by Perkins in Winter 2005. Look at thewinter 2005 and other recent CSE341 webs for a good idea of wherewe’re going.We’re also drawing on material developed by Keunwoo Lee when hetaught the course before that.CSE341 Winter 2006, Lecture 1 3'&$%Who and What• 3 class meetings (slides, code, and questions)– Material is on-line (subject to change), but print copies inadvance and take notes.• 1 section (Elizabeth Tseng and Shen-Hui Lee)– Essential material on tools, style, examples, language-features,...• Office hours (Elizabeth, Shen, Hal)– Use them!!! Times on the web.• Course “dictionary” online– To help with terminology; not tested; feedback welcomeCSE341 Winter 2006, Lecture 1 4'&$%Homeworks• Approximately weekly: 7–8 total, plus midterm and final exams• Doing the homework involves:1. Understanding the concepts being addressed2. Writing code demonstrating understanding of the concepts3. Testing your code to ensure you understand4. “Playing around” with variations, incorrect answers, etc.You turn in only (2), but focusing on (2) makes the homeworkharderCollaboration: The Gilligan’s Island RuleExtra Credit: Terrible use of your time grade-wise, but great otherwiseCSE341 Winter 2006, Lecture 1 5'&$%Academic IntegrityRead every word of the course policy very carefully.Always explain any unconventional action on your part.Promoting and enforcing academic integrity has been a personal focusof many of us for a long time:• I trust you completely• I have no sympathy for trust violations, nor should youHonest work is the most important feature of a university.CSE341 Winter 2006, Lecture 1 6'&$%Exams• Midterm: Monday February 6, in class (tentative)• Final: Monday, March 13, 8:30–10:20• Do not miss themSame concepts, but very different format from homework.CSE341 Winter 2006, Lecture 1 7'&$%Now where were we?Meetings, homeworks, and exams. . . about what?Programming languages:• Essential concepts relevant in any language• Specific examples “in natural setting” using ML, Scheme, andSmalltalk• Focus on “functional languages” because they are simpler, verypowerful, and teach good practicesFirst half of course uses ML:• Gives us time to build knowledge before “starting over”• But we need to get comfortable with the basics and environmentas soon as possible• “Let go of Java” for now (we will return to it)CSE341 Winter 2006, Lecture 1 8'&$%A strange environmentThe ML part of the course uses:• The emacs editor• A read-eval-print loop for evaluating programs• Available on Windows and UNIX in the lab — also can beinstalled on your own Windows, Linux, or OS X machineWe have prepared “getting started” materials, but leave plenty of timefor the content of homework 1.• Read the materials• Attend section• Then ask questions fast (wasted hours are wasted hours)Adjusting to new environments is a “CS life skill”CSE341 Winter 2006, Lecture 1 9'&$%Before we dive inWe’ll return to the course goals and “why learn something other thanC/C++/Java/Perl/Python” next week or so.(There are many good reasons, too important for the first day.)CSE341 Winter 2006, Lecture 1 10'&$%ML, from the beginning• A program is a sequence of bindings• One kind of binding is a variable bindingval x = e ; (semicolon optional in a file)• A program is evaluated by evaluating the bindings in order• A variable binding is evaluated by:– Evaluating the expression in the environment created by theprevious bindings. This produces a value.– Extending the (top-level) environment to bind the variable tothe value.Much easier to understand with an example. . .CSE341 Winter 2006, Lecture 1 11'&$%That was a lot at once• Values so far: integers, true, false, ()• Non-value expressions so far: addition, subtraction, less than,conditionals• Types: every expression has a type. So far, int, bool, unit• The read-eval-print loop:– Enter a sequence of bindings. For each, it tells you the valueand type of the new binding– If you just enter e;, then that is the same as val it = e;– use "foo.sml" enters the bindings in a file, and then bindsit to (), which has type unit– Ignore messages like “GC #0.0.0.0.1.18: (0 ms)”– Expressions that don’t type-check lead to (often obscure) errormessages and no change to the environmentCSE341 Winter 2006, Lecture 1 12'&$%Parts worth repe atingOur very simple program demonstrates many critical languageconcepts:• Expressions have a syntax (written form)– E.g.: A constant integer is written as a digit-sequence– E.g.: Addition expression is written e1 + e2• Expressions have types given their context– E.g.: In any context, an integer has type int– E.g.: If e1 and e2 have type int in the current context, thene1+e2 has type int• Expressions evaluate to values given their environment– E.g.: In any environment, an integer evaluates to itself– E.g.: If e1 and e2 evaluate to c1 and c2 in the currentenvironment, then e1+e2 evaluates to the sum of c1 and c2CSE341 Winter 2006, Lecture 1 13'&$%More expression formsWhat are the syntax-rules, typing-rules, and evaluation-rules for:• variables• less-than comparisons• conditional expressionsCSE341 Winter 2006, Lecture 1 14'&$%Lots more to doWe have many more types, expression forms, and binding forms tolearn before we can write “anything interesting”.Must develop resilience to mistakes and bad messages. Examplegotcha: x = 7 instead of val x = 7.For homework 1: functions, pairs, lists, options, and local bindings(earlier problems require less)But there are some things we will not add:• mutation (a.k.a. assignment): changing the value of anenvironment binding– make a new binding instead• statements: expressions will do just fine, thank you• loop-constructs: recursive functions are more powerfulCSE341 Winter 2006,


View Full Document

UW CSE 341 - Lecture Notes

Documents in this Course
Macros

Macros

6 pages

Macros

Macros

6 pages

Macros

Macros

3 pages

Mutation

Mutation

10 pages

Macros

Macros

17 pages

Racket

Racket

25 pages

Scheme

Scheme

9 pages

Macros

Macros

6 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?