Exercise 1.12. The following pattern of numbers is called Pascal's triangle.
The numbers at the edge of the triangle are all 1, and each number inside the triangle is the sum of the two numbers above it.
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
. . .
Write a procedure that computes elements of Pascal's triangle by means of a recursive process. If a number lies outside of the triangle, return 0 (this makes sense if we view pascal as the combination > > function ). Start counting rows and columns from 0.
I did the Exercise, it gave me an unexpected evaluation,so I try to figure it out why.
End up copying the answer hided in the html, the site evaluates it to be right,
I check in DrRacket with the folowing code.
The answer hided in the site is wrong, #the followings.
The quiz is:
I did the Exercise, it gave me an unexpected evaluation,so I try to figure it out why. End up copying the answer hided in the html, the site evaluates it to be right, I check in DrRacket with the folowing code. The answer hided in the site is wrong, #the followings.
terminal print out: