Summary of the Problem Solving of SiC exercise (2.4), sicp2.4
SICP exercise 2.4 is an interesting question. It will change your understanding of the data structure to a certain extent.
According to the question, we will talk about "procedural representation of ordinal pairs ".
The preface should be familiar to everyone. The previous questions are related to the collation. What does the "procedural representation" of the collation mean?
Simply put, we can use a process (or function) to implement sequential pairs.
Before that, for many programmers, data is data, the process is a process, and the two exist independently. The process is generally used to access data. It is a strange thing to use a process to implement the data structure.
Let's take a look at the example given in the question. The question says, if we have the following process definitions, then for any x and y, (car (cons x y )) will generate x:
(define (cons x y) (lambda (m) (m x y)))(define (car z) (z (lambda (p q) p)))
The above code is still difficult to read, because it involves two lambda processes.
As mentioned in the question, in order to better understand the process here, we suggest using replacement methods. Let's take a look at the replacement process:
(Car (cons x y ))
=> (Car (lambda (m) (m x y )))
=> (Lambda (m) (m x y) (lambda (p q) p ))
=> (Lambda (p q) p) x y)
=> (Lambda (x y) x ))
=> X
After I completed the replacement process for the first time, I felt incredible. It was like watching the cards disappear from Liu Qian's hand.
Here, cons returns a lambda function, which accepts a parameter and acts on x y.
Car accepts a parameter and acts on another lambda function. This lambda function accepts two parameters and returns the first parameter forever.
To connect cons and car is to "act on x y and always return the first parameter x ".
It is easy to complete the question after I understand it. The question requires us to define the corresponding cdr process based on this idea. The cdr code I have defined is as follows:
(define (cdr z) (z (lambda (p q) q)))
This means that cdr accepts a parameter and acts on a lambda process. The lambda process accepts two parameters and returns the second parameter forever.
In this way, the question has been completed. However, the inspiration for this question is worth pondering.
It is easy to complete the question, and it is difficult to understand the intention of the question ......
20 points Teaching Digital Signal Processing Wu zhenyang Second Edition exercises 24 28 325 answers and solutions
Lack of strength... I can't help you with these questions...
Reward 50 points answer everybody prawn help younger brother pep eighth grade next volume mathematics class exercises 193 Tenth Problem Solving Process urgent use
RT △abc △rt △aec (RT △aec is folded by RT △abc ),
AE = AB = 4 cm, CE = BC = AD = 3 cm,
Set CD and AE to F,
∠ CFE = vodafd, performancef = ∠ ADF = 90 degrees,
Therefore, signature FCE = signature FAD, CE = AD
RT △abc limit RT △aec, [ASA]
FE = FD,
AF ² = AD ² + FD ²,
(AE-FE) ² = AD 2 + FD 2,
(AE-FD) ² = AD 2 + FD 2,
(4-FD) ² = 3² + FD ²,
16-8FD = 9,
FD = 7/8 (cm) = FE,
FC = CD-FD = 4-7/8 = 25/8 (cm ),
For EH ⊥ CD, vertical foot H, EH * FC/2 = FD * AD/2, [RT △abc △rt △aec, with the same area]
EH * 25/8 = 7/8*3,
EH = 21/25 (cm ),
CH 2 = CE 2-HE 2 = 3²-(21/25) ² = (3² * 25²-21²)/25² = (75 + 21) (75-21)/25² = 96*54/25,
CH = 72/25 (cm ),
DH = CD-CH = 4-72/25 = 28/25,
DE ² = DH ² + EH ² = 28²/25² + 21²/25² = 1225/25 = 49/25,
DE = 7/5 (cm ),
S quadrilateral ACED = SRT △adc + S △dce
= AD * CD/2 + EH * CD/2
= 3*4/2 + 21/25*4/2
= 6 + 42/25
= 192/25
= 7.68 (cm 2)
AC ² = ab² + BC ² = 4² + 3² = 25,
AC = 5 (cm ),
The perimeter of the Quadrilateral ACED is AC + CE + DE + AD.
= 5 + 3 + 7/5 + 3
= 62/5
= 12.4 (cm)
Many procedures ~ Come on ~~