Factorial in Scheme
;(factorial 5) = 1 * 2 * 3 * 4 * 5 = 120
;(factorial 50) = 30414093201713378043612608166064768844377641568960512000000000000
(define factorial (lambda (n) (if (= n 0) 1 (* n (factorial (- n 1))))))
DZone Snippets > willpost > Factorial
12372 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
(define factorial (lambda (n) (if (= n 0) 1 (* n (factorial (- n 1))))))