scheme-playground/sicp-exercises/exercise1-10.scm

11 lines
174 B
Scheme
Raw Permalink Normal View History

2024-09-26 19:29:47 +00:00
(define (A x y)
(cond ((= y 0) 0)
((= x 0) (* 2 y))
((= y 1) 2)
(else (A (- x 1) (A x (- y 1))))))
(print (A 0 10))
(print (A 1 10))
(print (A 2 4))
(print (A 15 1))