htdp ch21 ch23

26
How to Design Programs :-) Chapter 21 ~ 23 unlimitedfocus

Upload: -

Post on 03-Aug-2015

230 views

Category:

Technology


1 download

TRANSCRIPT

How to Design Programs :-)Chapter 21 ~ 23unlimitedfocus

Contents

Chapter 21 Designing Abstractions from Examples

Chapter 22 Designing Abstractions with First-Class Functions

Chapter 23 Mathematical Examples

Chapter 21 Designing Abstractions from Examples Abstracting from Examples Finger Exercises with Abstract List

Functions Abstraction and a Single Point of Control Extended Exercise: Moving Pictures,

Again Note: Designing Abstractions from

Templates

21.1  Abstracting from Examples

The comparison:

The abstraction:

21.1  Abstracting from Examples

The abstraction:

The test:

21.3  Abstraction and a Single Point of Control

Guideline on Creating Abstractions Form an abstraction instead of copying and

modifying a piece of a program.

21.5  Note: Designing Abstractions from Templates Template for lists

Abstract over this programming task

Using reduce to define functions

Chapter 22 Designing Abstractions with First-Class Functions Functions that Produce Functions Designing Abstractions with Functions-as-

Values A First Look at Graphical User Interfaces

22.1  Functions that Produce Functions how a function can produce a function

Create function that adds x to its input

22.2  Designing Abstractions with Functions-as-Values Abstraction using local (ref. figure 53, ch19)

abstraction

22.3  A First Look at Graphical User Interfaces Model-View

The ideal program consists of two completely separate components:

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.

model contain no references to the view

22.3  A First Look at Graphical User Interfaces  The gui.ss operations

22.3  A First Look at Graphical User Interfaces There are four kinds of the data definition for gui-

items text fields,

which are created with (make-text a-string) and allow users to enter arbitrary text into an area in the window;

buttons, which are created with (make-button a-string a-function) and allow

users to apply a function with the click of a mouse button;

choice menus, which are created with (make-choice a-list-of-strings) and allow

users to pick a choice from a specified set of choices; and

message fields, which are created with (make-message a-string) and enable the

model to inform users of results.

Chapter 23 Mathematical Examples

Sequences and Series Arithmetic Sequences and Series Geometric Sequences and Series The Area Under a Function The Slope of a Function

23.1  Sequences and Series

Sequences

Series: sum of a sequence

23.1  Sequences and Series

Series: sum of a sequence

Basic abstraction recipe:

23.2  Arithmetic Sequences and Series Arithmetic sequence

23.3  Geometric Sequences and Series geometric sequence

Taylor Series

23.4  The Area Under a Function

Integrating a function f between a and b

23.5  The Slope of a Function

Integrating a function f between a and b

Summary

Chapter 21 Designing Abstractions from Examples Abstracting from differences Abstraction from Template Abstract List

Chapter 22 Designing Abstractions with First-Class Functions Abstractions with Functions-as-Values Graphical User Interfaces

Chapter 23 Mathematical Examples Mathematical functions for practicing programming

The End.

Thank you.