SCIP Exercise 1.12.

来源:互联网 发布:供给侧改革成效数据 编辑:程序博客网 时间:2024/04/28 17:23

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.35Write a procedure that computes elements of Pascal's triangle by means of a recursive process.


(define (pascal row col)        (cond ((= col 1) 1)              ((= row col) 1)              (else (+ (pascal (- row 1) col)                       (pascal (- row 1) (- col 1))))))


0 0
原创粉丝点击