Saturday, May 30, 2009

Ex-1.12

;; Find Pascal element
;; row = row number in the pascal triangle,
;; row >= 1
;; elt = elt'th element of the row,
;; 1 <= elt <= row
(define (pascal row elt)
(if (or (= elt 1) (= elt row)) 1
(+ (pascal (- row 1) (- elt 1))
(pascal (- row 1) elt))))

No comments:

Post a Comment