CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 11: Accumulating Recursion.

Slides:



Advertisements
Similar presentations
Homework for the week of Sept. 3rd, 2013 Monday Spelling:Spelling: Pages 7 and 8. Reading:Reading: 1 box of the IRR sheet. Use your AR book. Complete in.
Advertisements

Read the following: oo The zoo is too far from school oo The cook can cook good cookies ow The tree by the window grows slowly ow The cow is eating.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 4: Review Conditional & Word Stuff.
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 26: Printing and Stuff.
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.
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.
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.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 10: Recursion Rocks Again!
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 13: Bugs and Two Stage Recursion.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 20: Tree Recursion.
Administrivia Make sure you have completed the Mid Semester Survey –Scheduled the week before Spring Break –this will be worth some points Reading is.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 1: Introduction & Administration.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 8: Recursion.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 9: Recursion Rocks!
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 2: Review – Writing Procedures.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 16: Let and Lambda.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 25: Trees and Generalized Lists.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 27: Review – most children and truth about cons.
Slide 1 CS3 Fall 2005 Lecture 9: Higher Order Functions.
WHICH WAY and HOW FAR? SCALE AND DIRECTION What is scale and direction?
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 7: Review.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 15: Procedures as Arguments.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 5: Difference Between Dates Case Study.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 24: Review for lists, map and member.
CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 3: Conditional Expressions.
RECURSIVE PATTERNS WRITE A START VALUE… THEN WRITE THE PATTERN USING THE WORDS NOW AND NEXT: NEXT = NOW _________.
PYTHON PROGRAMMING Week 9 - Wednesday. WRITE A PROGRAM TO:  print all the numbers from 1 to 100  print all the even numbers from 1 to 100  print all.
August 13, 2014 Today ◦ Seating Chart ◦ Introductions ◦ Meet me ◦ Name Tags Tomorrow ◦ Finish Name Tags ◦ Appointment Clocks ◦ Syllabus ◦ Names Friday.
PRELIMINARY CONFERENCE PROGRAMME ( ) Conference programme overview Opening and plenary lectures plenary lectures and closing Day 1 Mon Sept 8.
Monday. Today’s Agenda: 1.No Warm-up 2.Abstinence Education Mon Sept 22, 2014 Assignments Due: Objective: 1. Students will comprehend concepts related.
CS61A Lecture Colleen Lewis. Clicker Query What else are you doing this summer? A)Taking another class B)Working C)Taking another class and.
Monday, January 27, 2014 What has been the most difficult task on your practice HSA so far? Explain. The Persistence of Memory By: Salvador Dali.
AP ENGLISH LANGUAGE AND COMPOSITION Wednesday, 2/11/15.
W20: 12-16, 2015 Week 19. Monday, January 12 Check in… - Homework in to bin Goal – ASWBAT… define what physical characteristics are and identify basic.
MS. LIVOTI STUDIO ART DAILY PLANS SEPT 3-4, 2015.
Practice is Fun Weekly Speech Schedule Daily Practice.
Part B Read and write. Monday, Tuesday, Wednesday, Thursday, Friday. Days for school. Saturday and Sunday, Days for fun. Happy time, fun time, for everyone.
Monday Question of the Day: How do people help each other? _____ helped me when I learned to ______.
Solving Quadratic Equations – Comparing and Contrasting Methods April 21, 2015.
Math 8 – Warm-up # 3 (Friday, August 10 th ) AGENDA Check homework pg. 92 (workbook) Kente Cloth Task.
2015 Academic A Modern Pakistan Lesson Date and Number Your Papers: Tuesday, April 14, 2015 Wednesday, April 15, 2015 Thursday, April 16, 2015 Friday,
Monday. Today’s Agenda: 1.Take Notes about Stress and Anger Management 2.Complete Lesson 9 Vocab and lesson 10 vocab Mon August 10, 2015 Assignments.
Warm Up-Accelerated Monday, November 2 No Warm-Up, Update TOC Homework Due Today: *No Homework Homework: Volcano Brochure due Monday 11/9 Science fair.
Tuesday, December 1 st  Grab a notes sheet off the projector  Please take out the following:  Purple sheet  Review questions  Yesterday’s worksheet.
Ms. Perez Math & Science Mrs. Mason English Language Arts & Social Studies Conference.
Science 8th Warm up. Wednesday Sept. 9, 2015 Entry Task:- Get out your notebooks and pencils Learning Target:-Properly prepare journals Success Criteria:
Warm Up-Accelerated Monday, November 9 No Warm-Up, Update TOC Homework Due Today: *Turn in your volcano brochure up front Homework: Science fair data chart,
BIO WEEK 9. Tuesday October 21, 2014 First Five: Why is it important to know what you eat? Learning Target: I can analyze and interpret data on the major.
Algebra 2 Monday Warm-Ups Check in and discuss A#6.5 Discussion/Notes/Guided Practice Section 6.6 Solving Polynomial Equations Assignment A#6.6.
Warm-up: Monday, Mon. May 14th Warm-up sheet due Tues Find the exact value of 2.Find the area of an oblique triangle having the following measurements.
After this class, I should be able to: Differentiate between ionic, covalent (polar and nonpolar) and metallic bonding Bell Ringer Question: Which subatomic.
Name: __________________________________________ Date: ______________________ Period: ____ Weekly Homework 7 th Show all of your work to get credit.
B B C C D D Herald Museum Fri [80] Wed [60] Tue & Thur [40] Visitors to Herald Museum Mon [20]
August 20, 2015 Due today: academic contract; survey In Class:  SLO pretest  What did you do fun this summer?  Team graphing Homework:  Gather/purchase.
Good Morning, Precalculus! To prepare for class: 1. Please find your DO NOW sheet and start today's DO NOW! Do Now: Find the semiperimeter of the triangle.
Introduction to SHM Wednesday, February 22, 2017.
نجاح وفشل المنشآت الصغيرة
1. Please turn in your SKILL BUILDER to the tray. 2
No written homework this week due to testing
Warm Up Find the pattern in the number sequences below:
Presentation transcript:

CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 11: Accumulating Recursion

Today Upcoming Homework Thurs: Bowling (Hwk11) due Monday Fri: Compress/occurs-in? (Hwk12) due Tuesday Mon: Mini-project 2 due Wednesday Lunch yesterday was fun ~10 people came Accumulating Recursion Recursion Patterns

Not Accumulating Recursion (define (sent-sum sent) (if (empty? sent) 0 (+ (first sent) (sent-sum (bf sent))))) 0 (sent-sum ‘(2 3 5 )) (+ 2 (sent-sum ‘(3 5)) (+ 3 (sent-sum ‘(5)) (+ 5 (sent-sum ‘()) >(sent-sum ‘(2 3 5)) (+ 2 (+ 3 (+ 5 0)))

Accumulating Recursion (define (sent-sum sent sum-so-far) (if (empty? sent) sum-so-far (sent-sum (bf sent) (+ sum-so-far (first sent))))) (sent-sum ‘(2 3 5 ) 0) (sent-sum ‘(3 5) 2) (sent-sum ‘(5) 5) (sent-sum ‘() 10) > (sent-sum ‘(2 3 5) 0)

Recursion Patterns Split into groups of 4 I’ll pass out a set of worksheets for each group Work on the work sheet as a team Join another group and explain your worksheet to them

Application-To-All (define (proc-applied-to-all sent) (if (empty? sent) ‘() (se (proc (first sent)) (proc-applied-to-all (bf sent))))))

Examples of Application to All Square-all Add-1-to-all Add-2-to-all Grocery-to-cost (food->cost) Calorie-counter (food -> calories) French-to-english English-to-piglatin

Filtering (define (filtered sent) (cond ((empty? sent) ‘()) ((interesting? (first sent)) (sent (first sent) (filtered (bf sent)))) (else (filtered (bf sent)))))

Examples of Filtering Keep-Multiples-of-5 Keep-Evens Keep-vowels Keep-words-with-even-num-letters Keep-Michael Gather-with-hair-color