Last active
February 6, 2016 14:21
-
-
Save realeroberto/c7f098f737f181985e1f to your computer and use it in GitHub Desktop.
Tail-recursive factorial in Scheme.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
; Tail-recursive factorial in Scheme. | |
; | |
(define (factorial n) | |
(if (= n 1) | |
1 | |
(* n (factorial(- n 1))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment