Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Defined factorial as an introductory function

  • Loading branch information...
commit e3ca8358c09ecb78a28fadfaaba4a74c9e4927c9 1 parent c5f4d7b
@apauley authored
Showing with 10 additions and 0 deletions.
  1. +9 −0 PeepCode/Clojure/fac.clj
  2. +1 −0  PeepCode/README
View
9 PeepCode/Clojure/fac.clj
@@ -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
1  PeepCode/README
@@ -0,0 +1 @@
+My attempts at implementing the tutorial examples.
Please sign in to comment.
Something went wrong with that request. Please try again.