Created
May 29, 2009 21:48
-
-
Save tebeka/120228 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env gsi-script | |
(define (fact n) | |
(let loop ((n n) (r 1)) | |
(if (< n 2) | |
r | |
(loop (- n 1) (* r n))))) | |
(if (not (= (length (command-line)) 2)) | |
(println "usage: fact1.scm NUMBER") | |
(let ((n (string->number (cadr (command-line))))) | |
(println (fact n)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment