Skip to content

Commit

Permalink
Sicp. 1.12.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sankara Rameswaran committed Apr 17, 2010
1 parent e60df1d commit fb2ebb0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,3 +1,6 @@
*.iml
*.iwl
*.ipr
*#
*~

13 changes: 13 additions & 0 deletions src/main/clojure/sicp/chapter-1/e_12.clj
@@ -0,0 +1,13 @@
(ns sicp.e-12)
(defn pascal
([r]
(for [i (range r)]
(for [j (range (inc i))]
(pascal i j))))
([i j]
(cond
(= j 0) 1
(= i j) 1
:else (+ (pascal (dec i) (dec j))
(pascal (dec i) j)))))
(pascal 4)

0 comments on commit fb2ebb0

Please sign in to comment.