/blog-catalan

A trial Clojure project for a blog post about the Catalan numbers.

Primary LanguageClojureEclipse Public License 1.0EPL-1.0

blog-catalan

A trial Clojure project for a blog post about the Catalan Numbers.

Usage

core namespace

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.

recur namespace

The namespace contains a catalan function which counts a Catalan number via recursion.

Midje tests

You can run all Midje tests by lein midje.

REPL

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)

License

Copyright © 2017 Vít Kotačka

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.