;;; hw02-problem1.ss ;;; Comp210, 98.spring ;;; ;;; Functions for problem 1 -- determine how many ;;; recursive calls are made (using Donkey), for 0 <= n <= 6. ;;; ;; fact: num -> num ;; Return n!, which stands for n*(n-1)*(n-2)*...*3*2*1 ;; (define fact (lambda (n) (if (zero? n) 1 (* n (fact (- n 1)))))) ;; multfib: num -> num ;; A multiplicative version of the fibonacci sequence. ;; (define multfib (lambda (n) (if (< n 3) n (* (multfib (- n 1)) (multfib (- n 2)))))) ;; threes: num -> num ;; Returns 1??? ;; (define threes (lambda (n) (if (< n 2) 1 (threes (if (even? n) (/ n 2) (+ 1 (* n 3)))))))