ClojureScript's persistent data structures and supporting API from the comfort of vanilla JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 281 commits behind swannodette:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A simple bridge to ClojureScript's persistent data structures and supporting APIs for vanilla JavaScript. Pull requests welcome.


You can download the latest prebuilt version of Mori from the downloads tab.


Pre-pre-pre alpha. ClojureScript is constantly being improved, especially in terms of performance. That said, it's probably still already useful.


Make a folder in the repo folder called checkouts, clone the ClojureScript repo into it.

Install Leiningen.

Grab dependencies:

lein deps

Build with:

lein cljsbuild once release

This will produce a file mori.js. You can include this like any other JavaScript library.

You can use it from your projects like so:

mori.into_array( { return x+1;}, mori.vector(1,2,3,4,5)));
// => [2,3,4,5,6]

Efficient non-destructive updates!

var v1 = mori.vector(1,2,3);
var v2 = mori.conj(v1, 4);
v1.toString(); // => '[1 2 3]'
v2.toString(); // => '[1 2 3 4]'
var sum = function(a, b) {
  return a + b;
mori.reduce(sum, mori.vector(1, 2, 3, 4)); // => 10

Lazy sequences!

var _ = mori;
_.into_array(_.interpose("foo", _.vector(1, 2, 3, 4)));
// => [1, "foo", 2, "foo", 3, "foo", 4]

Or if it's more your speed, use it from CoffeeScript!

inc = (x) -> x+1  
r =, mori.vector(1,2,3,4,5))


Mori includes the new Clojure reducers framework. Zero allocation collection operations FTW:

var m = mori;
var a = [];

for(var i = 0; i < 100000; i++) {

// make it immutable
var v = m.into(m.vector(), a);

m.reduce(m.sum, 0, m.rmap(, m.rfilter(m.is_even, v)));

Copyright (C) 2012 David Nolen

Distributed under the Eclipse Public License, the same as Clojure.