Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
×

# Htdp ch21 ch23

• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here

• Be the first to like this

### Htdp ch21 ch23

1. 1. How to Design Programs :-) Chapter 21 ~ 23 unlimitedfocus
2. 2. Contents <ul><li>Chapter 21 Designing Abstractions from Examples </li></ul><ul><li>Chapter 22 Designing Abstractions with First-Class Functions </li></ul><ul><li>Chapter 23 Mathematical Examples </li></ul>
3. 3. Chapter 21 Designing Abstractions from Examples <ul><li>Abstracting from Examples </li></ul><ul><li>Finger Exercises with Abstract List Functions </li></ul><ul><li>Abstraction and a Single Point of Control </li></ul><ul><li>Extended Exercise: Moving Pictures, Again </li></ul><ul><li>Note: Designing Abstractions from Templates </li></ul>
4. 4. 21.1  Abstracting from Examples <ul><li>The comparison: </li></ul><ul><li>The abstraction: </li></ul>
5. 5. 21.1  Abstracting from Examples <ul><li>The abstraction: </li></ul><ul><li>The test: </li></ul>
6. 6. 21.2  Finger Exercises with Abstract List Functions <ul><li>Built-in abstract functions (cont.) </li></ul>
7. 7. 21.2  Finger Exercises with Abstract List Functions <ul><li>Built-in abstract functions </li></ul>
8. 8. 21.3  Abstraction and a Single Point of Control <ul><li>Guideline on Creating Abstractions </li></ul><ul><ul><li>Form an abstraction instead of copying and modifying a piece of a program. </li></ul></ul>
9. 9. 21.4  Extended Exercise: Moving Pictures, Again <ul><li>Move </li></ul>
10. 10. 21.5  Note: Designing Abstractions from Templates <ul><li>Template for lists </li></ul><ul><li>A bstract over this programming task </li></ul><ul><li>Using reduce to define functions </li></ul>
11. 11. Chapter 22 Designing Abstractions with First-Class Functions <ul><li>Functions that Produce Functions </li></ul><ul><li>Designing Abstractions with Functions-as-Values </li></ul><ul><li>A First Look at Graphical User Interfaces </li></ul>
12. 12. 22.1  Functions that Produce Functions <ul><li>how a function can produce a function </li></ul><ul><li>Create function that adds x to its input </li></ul>
13. 13. 22.2  Designing Abstractions with Functions-as-Values <ul><li>Abstraction using local (ref. figure 53, ch19) </li></ul><ul><li>abstraction </li></ul>
14. 14. 22.3  A First Look at Graphical User Interfaces <ul><li>Model-View </li></ul><ul><ul><li>The ideal program consists of two completely separate components: </li></ul></ul><ul><ul><ul><li>the MODEL, which is the kind of program we are learning to design, and a VIEW, which is the GUI program that manages the display of information and the user's mouse and keyboard manipulations. The bridge between the two is the CONTROL expression. </li></ul></ul></ul><ul><ul><li>model contain no references to the view </li></ul></ul>
15. 15. 22.3  A First Look at Graphical User Interfaces <ul><li>  The gui.ss operations (cont.) </li></ul>
16. 16. 22.3  A First Look at Graphical User Interfaces <ul><li>  The gui.ss operations </li></ul>
17. 17. 22.3  A First Look at Graphical User Interfaces <ul><li>There are four kinds of the data definition for gui-items </li></ul><ul><ul><li>text fields, </li></ul></ul><ul><ul><ul><li>which are created with (make-text a-string) and allow users to enter arbitrary text into an area in the window; </li></ul></ul></ul><ul><ul><li>buttons, </li></ul></ul><ul><ul><ul><li>which are created with (make-button a-string a-function) and allow users to apply a function with the click of a mouse button; </li></ul></ul></ul><ul><ul><li>choice menus, </li></ul></ul><ul><ul><ul><li>which are created with (make-choice a-list-of-strings) and allow users to pick a choice from a specified set of choices; and </li></ul></ul></ul><ul><ul><li>message fields, </li></ul></ul><ul><ul><ul><li>which are created with (make-message a-string) and enable the model to inform users of results. </li></ul></ul></ul>
18. 18. Chapter 23 Mathematical Examples <ul><li>Sequences and Series </li></ul><ul><li>Arithmetic Sequences and Series </li></ul><ul><li>Geometric Sequences and Series </li></ul><ul><li>The Area Under a Function </li></ul><ul><li>The Slope of a Function </li></ul>
19. 19. 23.1  Sequences and Series <ul><li>Sequences </li></ul><ul><li>S eries : sum of a sequence </li></ul>
20. 20. 23.1  Sequences and Series <ul><li>S eries : sum of a sequence </li></ul><ul><li>Basic abstraction recipe: </li></ul>
21. 21. 23.2  Arithmetic Sequences and Series <ul><li>Arithmetic sequence </li></ul>
22. 22. 23.3  Geometric Sequences and Series <ul><li>geometric sequence </li></ul><ul><li>Taylor Series </li></ul>
23. 23. 23.4  The Area Under a Function <ul><li>Integrating a function f between a and b </li></ul>
24. 24. 23.5  The Slope of a Function <ul><li>Integrating a function f between a and b </li></ul>
25. 25. Summary <ul><li>Chapter 21 Designing Abstractions from Examples </li></ul><ul><ul><li>Abstracting from differences </li></ul></ul><ul><ul><li>Abstraction from Template </li></ul></ul><ul><ul><li>Abstract List </li></ul></ul><ul><li>Chapter 22 Designing Abstractions with First-Class Functions </li></ul><ul><ul><li>Abstractions with Functions-as-Values </li></ul></ul><ul><ul><li>Graphical User Interfaces </li></ul></ul><ul><li>Chapter 23 Mathematical Examples </li></ul><ul><ul><li>Mathematical functions for practicing programming </li></ul></ul>
26. 26. The End. <ul><li>Thank you. </li></ul>