A trial Clojure project for a blog post about the Catalan Numbers.
The namespace contains three basic functions:
factorial
counts a factorial.binomial
counts a binomial coefficient.catalan
counts a Catalan number.
All these funcitons build on top of each other - catalan
uses binomial
which uses factorial
.
Additionally, there is a function catalans
which returns a lazy sequence of the Catalan numbers.
The namespace contains a catalan
function which counts a Catalan number via recursion.
You can run all Midje tests by lein midje
.
You can load the functions into the REPL with:
(require '[blog-catalan.core :as c]
'[blog-catalan.recur :as r])
(c/catalan 5)
(r/catalan 5)
Copyright © 2017 Vít Kotačka
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.