;;; SIGNATUR ;;; multiply: number number -> number ;;; ERKLÄRUNG ;;; (multiply m n) berechnet das Produkt der natürlichen Zahlen m und n ;;; BEISPIEL ;;; (multiply 2 3) ;;; => 6 ;;; DEFINITION (define multiply (lambda (m n) (if (= n 0) 0 (+ m (multiply m (- n 1)))))) ;;; SIGNATUR ;;; multiply-it: number number -> number ;;; ERKLÄRUNG ;;; (multiply-it m n) berechnet das Produkt der natürlichen Zahlen m und n ;;; BEISPIEL ;;; (multiply-it 2 3) ;;; => 6 ;;; DEFINITION (define multiply-it (lambda (m n) (multiply-it-1 m n 0))) ;;; SIGNATUR ;;; multiply-it-1: number number number -> number ;;; ERKLÄRUNG ;;; (multiply-it m n acc) berechnet die Summe des Produktes der natürlichen ;;; Zahlen m und n sowie der Zahl acc. ;;; BEISPIEL ;;; (multiply-it-1 2 3 0) ;;; => 6 ;;; DEFINITION (define multiply-it-1 (lambda (m n acc) (if (= n 0) acc (multiply-it-1 m (- n 1) (+ acc m)))))