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.

Slides:



Advertisements
Similar presentations
Which season do you like best? 1106 Grade 8 Unit 9.
Advertisements

Chubaka Producciones Presenta :.
CS3 Fall 2005 Lecture 11: Finish higher order functions Midterm Prep.
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.
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.
CS3 Fall 2005 Lecture 10: More on higher order functions.
2012 JANUARY Sun Mon Tue Wed Thu Fri Sat
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.
Slide 1. Slide 2 Midterm 1 You did great If you need a regrade, see the person that graded that question Solutions available on the portal soon.
January 2012 Monday Tuesday Wednesday Thursday Friday Sat/ Sun / /8 14/15 21/22 28/
Administrivia Make sure you have completed the Mid Semester Survey –Scheduled the week before Spring Break –this will be worth some points Reading is.
Feb 28More complicated recursions March 7Tree recursion, etc. Number-spelling Miniproject (#2) March 14Higher order procedures March 21Spring Break March.
Midterm Logistics Where? 4 Leconte ( When? Monday, 4:10 to 5:40 What to do? –“Review problems”
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 9: Recursion Rocks!
P Pathophysiology Calendar. SundayMondayTuesdayWednesdayThursdayFridaySaturday January 2012.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 16: Let and Lambda.
Slide 1 CS3 Fall 2005 Lecture 9: Higher Order Functions.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 15: Procedures as Arguments.
Chicas, este calendario si es pa' nosotras !!!!!.
MONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSAT/SUN Note: You can print this template to use as a wall calendar. You can also copy the slide for any month to add.
2007 Monthly Calendar You can print this template to use it as a wall calendar, or you can copy the page for any month to add it to your own presentation.
MONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSAT/SUN Note: You can print this template to use as a wall calendar. You can also copy the slide for any month to add.

WORD JUMBLE. Months of the year Word in jumbled form e r r f b u y a Word in jumbled form e r r f b u y a february Click for the answer Next Question.
WEATHER BY: JENNIFER FAUTH KINDERGARTEN.
DATE POWER 2 INCOME JANUARY 100member X 25.00P2, FEBRUARY 200member X 25.00P5, MARCH 400member X 25.00P10, APRIL 800member.
Calendar for 2011 Months of the Year with Holidays.
2011 Calendar Important Dates/Events/Homework. SunSatFriThursWedTuesMon January
TEMPORAL VISUALIZATION OF DATA FROM THE FRENCH SENTINEL NETWORK.
July 2007 SundayMondayTuesdayWednesdayThursdayFridaySaturday
Deadline for Requisitions Payment Processing Date
Deadline for Requisitions Payment Processing Date
Dictation practice 2nd Form Ms. Micaela-Ms. Verónica.
McDonald’s Kalender 2009.
McDonald’s Kalender 2009.
JANUARY 2018 SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY
13-block rotation schedule
1   1.テキストの入れ替え テキストを自由に入れ替えることができます。 フチなし全面印刷がおすすめです。 印刷のポイント.
January MON TUE WED THU FRI SAT SUN
January MON TUE WED THU FRI SAT SUN
The SAT will be given at ECHS on the dates below!
McDonald’s Kalender 2009.
January Sun Mon Tue Wed Thu Fri Sat
January MON TUE WED THU FRI SAT SUN
January MON TUE WED THU FRI SAT SUN
0845 Analysis I have only very recently taken over responsibility for the 0845 number and whilst questions were asked of Derrick some months ago, we have.
Problem Gambling Clicks to Opgr.org
2300 (11PM) September 21 Blue line is meridian..
January MON TUE WED THU FRI SAT SUN
McDonald’s calendar 2007.
1 - January - Sun Mon The Wed Thu Fri Sat
Teacher name August phone: Enter text here.
January MON TUE WED THU FRI SAT SUN
JANUARY 1 Sun Mon Tue Wed Thu Fri Sat
Calendar.
January MON TUE WED THU FRI SAT SUN
JANUARY 1 Sun Mon Tue Wed Thu Fri Sat
February 2007 Note: Source:.
| January Sunday Monday Tuesday Wednesday Thursday Friday
January MON TUE WED THU FRI SAT SUN
S M T W F S M T W F
JANUARY 1 Sun Mon Tue Wed Thu Fri Sat
McDonald’s calendar 2007.
1 January 2018 Sun Mon Tue Wed Thu Fri Sat
Habitat Changes and Fish Migration
January Monday Tuesday Wednesday Thursday Friday Saturday Sunday 30 31
2015 January February March April May June July August September
Habitat Changes and Fish Migration
Presentation transcript:

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 for not getting the midterm solutions and last week's lecture on-line: check tomorrow.

Slide 3 March 7Tree recursion, etc. Number-spelling Miniproject (#2) March 14Higher order procedures March 21Spring Break March 28More HOF, tic-tac-toe Elections Miniproject (#3) April 4Case Study: Making Change (tree- recursion) April 11Midterm #2 (during lecture) Extending sentences, words to lists (in lab) April 18Advanced list processing (recursion) Start on the big project

Slide 4 > (find-evens '( ))  (se 2 (se 4 (se 6 ())  (2 4 6) (se 2 (se 4 (se 6 () sent = ( ) sent = ( ) sent = ( ) sent = ( 5 6 ) sent = ( 6 ) sent = ( )

Slide 5 Find all the even numbers (define (find-evens sent) (cond ((empty? sent) ;base case '() ) ((odd? (first sent)) ;rec case 1 (find-evens (bf sent)) ) (else ;rec case 2: even (se (first sent) (find-evens (bf sent))) ) ))

Slide 6 (define (pascal C R) (cond ((= C 0) 1) ;base case ((= C R) 1) ;base case (else ;tree recurse (+ (pascal C (- R 1)) (pascal (- C 1) (- R 1)) )))

Slide 7 > (pascal 2 5) (+ (pascal 2 5) (pascal 2 4) (pascal 1 4) (+ (pascal 2 3) (pascal 1 3) (pascal 0 3) (+ (pascal 2 2) (pascal 1 2) (pascal 0 2)  1 (pascal 1 2) (pascal 0 2)  1 (+ (pascal 1 1) (pascal 0 1)  1 (+ (pascal 1 1)  1 (pascal 0 1)  1 (+ (pascal 1 1)  1 (pascal 0 1)  1

Slide 8 What is a procedure? (or, a function).

Slide 9 Treating functions as things “define” associates a name with a value –The usual form associates a name with a object that is a function (define (square x) (* x x)) (define (pi) ) –You can define other objects, though: (define *pi* ) (define *month-names* ‘(january february march april may june july august september october november december))

Slide 10 Consider two forms of “month-name”: (define (month-name1 date) (first date)) (define month-name2 first)

Slide 11 Why have procedures as objects? Other programming languages don’t (often)

Slide 12 Procedures can be taken as arguments… (define (apply-to-5-and-3 func) (func 5 3)) (define (math-function? func) (or (equal? func +) (equal? func -) (equal? func *) (equal? func /)))

Slide 13 …and procedures can be returned from procedures (define (choose-func name) (cond ((equal? name ‘plus) +) ((equal? name ‘minus) -) ((equal? name ‘divide) /) (else ‘sorry))) (define (make-add-to number) (lambda (x) (+ number x))) (define add-to-5 (make-add-to 5))

Slide 14 Higher order function (HOFs) A HOF is a function that takes a function as an argument. There are three main ones that work with words and sentences: –every – do something to each element –keep – return only certain elements –accumulate – combine the elements

Slide 15 Patterns for simple recursions Most recursive functions that operate on a sentence fall into: –Mapping: square-all –Counting: count-vowels, count-evens –Finding: member, first-even –Filtering: keep-evens –Testing: all-even? –Combining: sum-evens

Slide 16 (define (square-all sent) (if (empty? sent) ‘() (se (square (first sent)) (square-all (bf sent)) )) (square-all ‘( )) (every square ‘( ))