The screenshots above show off complete working solutions to some CodeCombat levels, and Clojure's expressivity really shines in a few of them (Molotov Medic, Gold Rush, Find the Spy).
Clojure, the language:
Clojure is a dialect of the Lisp programming language. It has many features geared towards making it easy to reason about complex code: things like favoring functional programming over procedural code, persistent data structures, special constructs for concurrent programming, and Lisp macros for cases when a solution is best expressed in terms of the problem domain rather than having to be twisted to fit the programming language. It also has interop features for easy two-way interaction with Java code, enabling the use of thousands of established Java libraries.
Closer, the parser:
Closer.js is a parser for the Clojure programming language written in JavaScript, compatible with the Mozilla Parser API. It also provides much of the Clojure core library (118 functions at the moment). All of this is heavily tested, with > 90% code coverage (the untested 10% is mostly unused code from the Jison parser generator).
Key Features:
- Special forms
- def
- if
- do
- let
- fn
- loop / recur
- Persistent data structures (courtesy mori)
- JavaScript interop
- Destructuring forms
- Anonymous function literals
- More than 100 functions from clojure.core
- Many of the core functions can work with lazy sequences, like
range
,map
,filter
,iterate
,take
andrepeat
- In loose mode, the parser can handle common syntax errors (missing / excess parentheses at the end, etc.) and will always return a valid AST, even if empty, similar to Acorn's loose mode
Check out the usage instructions and the demo page.
Closer is available as an NPM module. It works on Node.js and all modern browsers (via browserify). It has been tested on Node 0.10.24, Chromium 34, and Firefox 28. The license used is MIT.
Log in or sign up for Devpost to join the conversation.