Javascript Library with clojure.cores api

I think, that next to a lot of other things, clojure brings a lot of value through its excellent standard library clojure.core (api and implementation). I am trying to sneak in some aspects of clojure into my workplace; working on web-applications mainly with js.

Recently I am using more and more functional programming techniques in javascript, which is a little bit harder because of its mutable data-structures. I am working with js-datastructures as if they were immutable using things like the new spread operator etc. (I am trying to avoid libs like Immutable.js for this). Now I am encountering problems which are already solved by clojures way of assoc’ing data or the threading macros.

My idea is to use functions like assoc, assoc-in or juxt, first because the api is solid and second to familiarize my coworkers with some clojure functions to maybe one day sneak a little bit of clojure into our projects :wink:

Now to the question(s): "Does anyone know a js library, which implements (as fas as possible) the clojure.core library? Or is there a different way (e.g. using clojurescript)? Or are there reasons for why this idea is dumb :smiley:?"

Thank you for your feedback and ideas :slight_smile:

1 Like

You can find a lot of Clojure/Script in (I‘ve recommended this author on various occasions on this board). A utility library I like for the „core“ stuff is - it uses some familiar names like assoc and has immutable-ish API. Beware tho, the functions have different call styles, argument orders etc than what you find in Clojure.

Whether your idea is good or not, time will tell I guess! Familiarizing a team with more/foreign concepts and names can help a lot, but it doesn’t help much with understanding.


Check out for using cljs.core in JS for real.


I would recommend immer, which we used in production for years in TypeScript projects.

While it’s not as efficient as persistent data structure implemented in Clojure, it’s using plain JavaScript syntax so it’s nicer for js libraries and js programmers. Using libraries like immutable-js requires you to call toJs and fromJs very frequently while gluing APIs using different data structures. It’s internally using trees for structural sharing. Immer is using plain objects with proxies and Object.freeze, just in the way of js. Combining immer and lodash, you also get a similar experience to cljs.

1 Like

I’ve had success with Ramdajs in a couple of Typescript projects now. So much that it has become my go to collections tool in JS-land. I haven’t tried immer though, that could be interesting as well.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.