Lemonad
1 a functional JavaScript library
Lemonad is a JavaScript library supporting functional programming inspired by Clojure, ClojureScript, Functional JavaScript, ML, Haskell, Forth and Underscore. It requires the presence of either Underscore or Lo-Dash and the Underscore-contrib libraries.
2 why?
The main motivation for Lemonad is that my current work requires the use of JavaScript on the client side and ClojureScript is not an option. As a result I decided to try and capture the "feel" of a ClojureScript experience in the guise of JavaScript. Over time the library evolved to incorporate other influences while maintaining an adherence to operating with JavaScript core types. I thought this might be useful for others, so here it is. Enjoy.
3 getting
Lemonad can be installed via NPM by adding the following to your package.json
file:
"dependencies": { "lemonad": ">= 0.6.2", }
You can also find the Lemonad source code on Github at http://github.com/fogus/lemonad.
4 including
Whether you use Lemonad via Node.js, within a web page or some other method, including the lemonad.js
file defines a global variable named L
that is used as the module for its capabilities.
On a web page, you'll need to do the following:
<script type="text/javascript" src="underscore.js"></script> <script type="text/javascript" src="underscore.array.builders.js"></script> <script type="text/javascript" src="underscore.array.selectors.js"></script> <script type="text/javascript" src="underscore.function.combinators.js"></script> <script type="text/javascript" src="underscore.function.predicates.js"></script> <script type="text/javascript" src="underscore.util.existential.js"></script> <script type="text/javascript" src="lemonad.js"></script>
An explicit dependency on Underscore version 1.4.0 or greater is required for now.
5 using
Documentation for using Lemonad is in development. For now you can look at the Lemonad specs and their source code to get a feel for using it.
6 thanks
Remember, contibutions welcomed.