Hacker News new | past | comments | ask | show | jobs | submit login
ClojureScript's persistent data structures in vanilla JavaScript (github.com)
60 points by DanielRibeiro on May 25, 2013 | hide | past | web | favorite | 9 comments



Rationale and documentation here http://swannodette.github.io/mori/

Feedback welcome on what people would like to see. I prefer to use the data structures from ClojureScript but I thought it might be interesting to provide them to JavaScript developers. Note it's not a small dependency (~21K gzipped) so I think people are more likely to use them from Node.

The library also provides access to Clojure style reducers as well as Clojure's functional zippers.

I'm open to ideas about making the usage more idiomatic for JavaScript developers - pull requests welcome.


Very cool. I like ClojureScript and believe that immutability is usually the better choice, but I don't always want to deal with the Closure compiler and somewhat involved build process. This takes some of the best qualities of ClojureScript and makes them portable. Writing highly functional CoffeeScript with these data structures sounds quite appealing in situations where ClojureScript might be overkill or doesn't fit well into the stack.


Use lein-cljsbuild to compile ClojureScript as soon as the file change is made. After the intial JVM startup, compilation is instant. https://github.com/emezeske/lein-cljsbuild

-- more --

ClojureScript is the Clojure language compiler that targets JavaScript. It compiles to Google Closure (not Clojure) JavaScript, but it can also target NodeJS. ClojureScript lets you use Clojure in the browser, adds Clojure data types to the JavaScript language, and allows for JavaScript to interact with the Clojure datatypes. Here's the side by side comparison https://himera.herokuapp.com/synonym.html

One of the most obvious additions to JavaScript is the ability to partition your JavaScript with namespaces.


Definitely not instant compilation. The app I'm currently working on has 6k lines of code and the incremental compilations take a little over 6 seconds.


Hmm, sounds like you have a fairly large namespace instead of separate ones?


Can someone with some insight tell me what ClosureScript is exactly about, what it's for or if it's worth keeping an eye open for it? That would be great.

I did my own research but would like to hear one or two more opinions. Thank you.


Like Scala/Clojure on the JVM, F#/ClojureCLR on .Net, or Coffeescript/Typescript on Javascript, it adds higher-level programming language semantics to programs running in a browser, NodeJS, Rhino, or any other javascript VM.

Features like namespaces, immutability, fast persistent data structures, and, if you are already using JVM Clojure in the same application, the Clojure language. Not to mention, the EDN data transport format, which means you can unify the server-side language, the client-side language, and the data transport format to Clojure (just like what javascript champions talk about with JS, JSON, and NodeJS).


ClojureScript is the Clojure language compiler that targets JavaScript. It compiles to Google Closure (not Clojure) JavaScript, but it can also target NodeJS. ClojureScript lets you use Clojure in the browser, adds Clojure data types to the JavaScript language, and allows for JavaScript to interact with the Clojure datatypes. Here's the side by side comparison https://himera.herokuapp.com/synonym.html

One of the most obvious additions to JavaScript is the ability to partition your JavaScript with namespaces.


ClojureScript is an implementation of the Clojure programming language that targets JavaScript. You can find out more about the Clojure programming language here: http://clojure.org




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: