Ad
Code
Diff
  • #lang racket
    
    (provide factorial)
    
    (define (factorial n)
      (if (<= n 1)
          1
          (* n (factorial (sub1 n)))))
    • #lang racket
    • (provide factorial)
    • (define factorial
    • (lambda (n)
    • (cond
    • ((<= n 1) 1)
    • (#t (* n (factorial (- n 1)))))))
    • (define (factorial n)
    • (if (<= n 1)
    • 1
    • (* n (factorial (sub1 n)))))