Permalink
Browse files

Defined factorial as an introductory function

  • Loading branch information...
1 parent c5f4d7b commit e3ca8358c09ecb78a28fadfaaba4a74c9e4927c9 Andreas Pauley committed Dec 13, 2009
Showing with 10 additions and 0 deletions.
  1. +9 −0 PeepCode/Clojure/fac.clj
  2. +1 −0 PeepCode/README
View
@@ -0,0 +1,9 @@
+#!/usr/bin/env clj
+
+(defn fac [n]
+ "Returns the factorial of n"
+ (if (= n 1)
+ 1
+ (* n (fac (- n 1)))))
+
+(println (fac 3))
View
@@ -0,0 +1 @@
+My attempts at implementing the tutorial examples.

0 comments on commit e3ca835

Please sign in to comment.