CS3 Fall 2005 Lecture 11: Finish higher order functions Midterm Prep.

Slides:



Advertisements
Similar presentations
מבוא מורחב למדעי המחשב בשפת Scheme תרגול 5. 2 List Utilities Scheme built-in procedures –(list x y z...) –(list-ref lst index) –(length lst) –(append.
Advertisements

Modern Programming Languages, 2nd ed.
1 Programming Languages (CS 550) Lecture Summary Functional Programming and Operational Semantics for Scheme Jeremy R. Johnson.
CSE 341 Lecture 16 More Scheme: lists; helpers; let/let*; higher-order functions; lambdas slides created by Marty Stepp
Cs1120 Fall 2009 David Evans Lecture 16: Power Analysis.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 17: HOF and Tick-Tack-Toe.
Slide 1 CS3: Lecture 8 Advanced recursion. Slide 2 Schedule Oct 10Advanced recursion Oct 17Number-spelling Miniproject Oct 24Higher order procedures Oct.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 18: HOF.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 14: Number Spelling Mini-project.
Slide 1 CS3 Week 8: Recursion. Slide 2 Midterm 1 You did great If you need a re- grade, see the person that graded that question Solutions are available.
Slide 1. Slide 2 Administrivia Mid-semester survey this week (Thur/Fri) –you NEED to do this. Interviews should be starting in a few weeks. I apologize.
CS3 Fall 2005 Lecture 10: More on higher order functions.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 12: Homework stuff and Accumulating Recursion.
Slide 1 CS3 Fall 2005 Lecture week 13: Introduction to the Big Project.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 19: HOF Problems.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 6: Mini-Project Prep.
CS3: Introduction to Symbolic Programming Spring 2006Nate Titterton Lecture 4: "Difference Between Dates" and data abstraction.
Slide 1 Midterm 1 Midterm 1: Feb 28 th (next week). –In the lecture slot, plus 20 minutes (4:10-5:30 pm, 120 Latimer) –Everything we’ve covered, including.
Data Abstraction… The truth comes out…. What we’re doing today… Abstraction ADT: Dotted Pair ADT: List Box and Pointer List Recursion Deep List Recursion.
CS 330 Programming Languages 11 / 20 / 2007 Instructor: Michael Eckmann.
CS 330 Programming Languages 11 / 18 / 2008 Instructor: Michael Eckmann.
CS 280 Data Structures Professor John Peterson. Goals Understand “Programming in the small” Java programming Know what’s under the hood in complex libraries.
Administrivia Make sure you have completed the Mid Semester Survey –Scheduled the week before Spring Break –this will be worth some points Reading is.
CS 280 Data Structures Professor John Peterson. Goals Understand “Programming in the small” Java programming Know what’s under the hood in complex libraries.
Feb 28More complicated recursions March 7Tree recursion, etc. Number-spelling Miniproject (#2) March 14Higher order procedures March 21Spring Break March.
Slide 1 Announcements Nate's office hours: –Monday, 12-2 –329 Soda Card key issues? (I've been told that any requests made before September 1 st didn't.
CS3: Introduction to Symbolic Programming Spring 2006Nate Titterton Lecture 2: Introduction, and Conditionals.
CS 3 Final Review Gilbert Chou, Jenny Franco and Colleen Lewis December 14, pm GPB.
Administrative Issues ICS 151 Fall 2007 Instructor: Eli Bozorgzadeh.
Midterm Logistics Where? 2050 VLSB When? Monday, 4:10 to 5:40 What to do? –“Review problems” from Thursday/Friday in UCWise. –Two practice exams and solutions.
Slide 1 CS3 Fall 2005 Lecture 9: Higher Order Functions.
CS3 Fall 2005 Lecture week 15. Administrivia The final survey will be up tomorrow: –you NEED to do this to receive a grade on your project! Final: –Saturday,
Administrivia Interviews this week: ex-TA Paul Hale Nate's office hours, as usual: Wed 2-4 The final survey will be up by Thursday: –you NEED to do this,
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 15: Procedures as Arguments.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 24: Review for lists, map and member.
Slide 1. Slide 2 Administrivia Nate's office hours are Wed, 2-4, in 329 Soda! TA Clint will be handing out a paper survey in class sometime this week.
Make sure you know the day and time of the final exam for this section of Math 110: Day: ______ Date:______ Time: ______ to _______ All Math 110 finals.
Spring 2008Programming Development Techniques 1 Topic 6 Hierarchical Data and the Closure Property Section September 2008.
Cs1120 Fall 2009 David Evans Lecture 20: Programming with State.
David Evans Class 13: Quicksort, Problems and Procedures CS150: Computer Science University of Virginia Computer Science.
Lecture 2-1CS250: Intro to AI/Lisp Intelligent Agents Lecture 3-2 October 14 th, 1999 CS250.
Scheme & Functional Programming. ( ) >> 64 ( ) >> 666 (* ) >> 1200 (+ (* 3 5) (- 10 6)) >> 19.
Introduction to Databases Computer Science 557 September 2007 Instructor: Joe Bockhorst University of Wisconsin - Milwaukee.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 18: Think Globally, Mutate Locally.
14-October-2002cse Lists © 2002 University of Washington1 Lists CSE 413, Autumn 2002 Programming Languages
Announcements Project1 Due Wednesday September 21 st 4:30pm We will post instructions on how to turnin from home Note: you can always turn in from the.
A Second Look At ML 1. Outline Patterns Local variable definitions A sorting example 2.
CS 104 – Fall 2011 Exploring Computer Science Lecture 20: November 14, 2011 Procedural Abstraction and List Processing.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 19: Environments.
More Inheritance 7/2/2009. Important Dates Project 1 - Check-off – Thursday 7/02/2009 ready BEFORE lab Review Session – Sunday 7/05/2009 – 306 Soda 1-4pm.
Chapter SevenModern Programming Languages1 A Second Look At ML.
Fall 2008Programming Development Techniques 1 Topic 8 Sequences as Conventional Interfaces Section October 2008.
REMINDER: If you haven’t yet passed the Gateway Quiz, make sure you take it this week! (You can find more practice quizzes online in the Gateway Info menu.
מבוא מורחב למדעי המחשב בשפת Scheme תרגול 6. 2 List Utilities Scheme built-in procedures –(list x y z...) –(list-ref lst index) –(length lst) –(append.
Parallel & Distributed Computing Fall 2006 Comments About Final.
CompSci 101 Introduction to Computer Science November 11, 2014 Prof. Rodger CompSci 101 Fall Review for exam.
REMINDER: If you haven’t yet passed the Gateway Quiz, make sure you take it this week! (You can find more practice quizzes online in the Gateway Info menu.
CS 360 Lab 1 Professor: Krzysztof Nowak TA: Mark Boady.
CS3: Introduction to Symbolic Programming Spring 2006Nate Titterton Lecture 2: Introduction, and Conditionals.
Pairs and Lists. Data Abstraction. SICP: Sections – 2.2.1
Announcements Quiz 4 will be on next Friday (4/3). It will cover materials from Chapter 4. Check your grades on WebCT and notify me promptly if you see.
Racket CSC270 Pepper major portions credited to
6.001 SICP Data abstractions
Lecture 15: Tables and OOP
Lecture 28: Types of Types
Announcements Nate’s office hours Card key problems?
Announcements Quiz 5 HW6 due October 23
Today’s topics Abstractions Procedural Data
Administrative Issues
CS 403: Programming Languages
Presentation transcript:

CS3 Fall 2005 Lecture 11: Finish higher order functions Midterm Prep

Oct 31More HOF – "tic-tac-toe" program: SS chapter 10! – "Change Making" case study, in the reader Nov 7Miniproject #3: Election-processing – Thursday a catch-up day, Friday is a holiday – MiniProject #3 due Thur/Fri: plan ahead! Nov 14Midterm #2 Lab: Lists (extending words and sentences) Nov 21Start on the project: check-off #1 Nov 28Work on the project: checks #2 Dec 5Checkoff #3, finish the project Dec 17Final Exam (midterm #3)

Programming Style and Grading During grading, we are going to start becoming “more strict” on style issues –MiniProject #3 will be the start –For the big project, style is important Why? –Program maintenance: 6 months later, will you know what your code does? –Code “literacy”: sharing code

What issues of style matter? Keep procedures small ! Good names for procedures and parameters Adequate comments –Above and within procedures Avoid nesting conditional statements Put tests cases in a comment block Indent to aid program comprehension

Midterm 2 Midterm 2: Nov. 14 th (next Monday). –In the lecture slot plus 30 minutes (4-5:30 pm, 120 Latimer) –Practice exam in reader (do this all at once) –Check announcements for more practice items and solutions. Review session –this Wednesday (Nov. 9), 7-9 p.m. –306 Soda Hall (HP Auditorium).

What does midterm #2 cover? –Advanced recursion (accumulating, multiple arguments, etc.) –All of higher order functions –Those "big" homeworks (bowling, compress, and occurs-in) –Elections miniproject –Reading and programs: Change making, Difference between dates #3 (HOF), tic-tac-toe –SS chapters 14, 15, 7, 8, 9, 10 –Everything before the first Midterm (although, this won't be the focus of a question)

When do you NEED lambda? 1.When you need the context (add-suffix '-is-great '(nate sam mary))  (nate-is-great sam-is-great mary-is-great) 2.When you need to make a function on the fly

Procedures that make procedures Generally, name procedures that create procedures "make-XXX" (make-bookends 'o)  #[closure arglist=(inner-wd) d7d0e0] ((make-bookends 'o) 'hi)  ohio ((make-bookends 'to) 'ron)  toronto (define tom-bookend (make-bookends 'tom)) (tom-bookends "")  tomtom

Write successive-concatenation (sc '(a b c d e))  (a ab abc abcd abcde) (sc '(the big red barn))  (the thebig thebigred thebigredbarn) (define (sc sent) (accumulate (lambda ?? ) sent))

make-decreasing –Takes a sentence of numbers –Returns a sentence of numbers, having removed elements of the input that were not larger than all numbers to the right of them. (make-decreasing '( ))  ( ) (make-decreasing '(3))  (3)

Chips and Drinks (snack 1 2)  3 –This includes (chip, drink, drink), (drink, chip, drink), and (drink, drink, chip). (snack 2 2)  6 –(c c d d), (c d c d), (c d d c) (d c c d), (d c d c), (d d c c) "I have some bags of chips and some drinks. How many different ways can I finish all of these snacks if I eat one at a time?

Lists (after the midterm) Lists are containers, like sentences where each element can be anything –Including, another list ((beatles 4) (beck 1) ((everly brothers) 2) … ) ((california 55) (florida 23) ((new york) 45) ) (#f #t #t #f #f …)

List constructors cons –Takes an element and a list –Returns a list with the element at the front, and the list contents trailing Append –Takes two lists –Returns a list with the element of each lists put together List –Takes any number of elements –Returns the list with those elements

List selectors car –Like first cdr –Like butfirst

Common list procedures Map = every Filter = keep Reduce = accumulate Null? = empty? Recursion is just the same!