Fork me on GitHub

I’ve just released a functional statecharts library for Clojure and ClojureScript. Documentation is missing at the moment, but there are over 100 tests you can consult to check the functionality. Semantics are based on the SCXML standard

Lucy Wang11:10:59

What's your major use case for inventing this lib? I've also created a clj/cljs statecharts library for better state management in re-frame apps and some custom script


@UP90Q48J3 I didn’t know about your lib, I’ll definitely check your implementation! As for the usecase, I’ve started working on it last year as part of the research for (In the end I’ve went with a different approach for keechma/next), but I’ve never finished it. I’m starting some work on a backend system that needs to have a pretty flexible business logic, so I’m planning to use statecharts + (or an approach similar to it) to implement it.


I wanted to implement statecharts as a pure function without internal state to ensure I can use it in any context I need (and provide my own persistence on top of it). This was inspired by the library

Lucy Wang12:10:10

Cool. You could also take a look the most popular js statecharts lib xstate (if not yet) , my lib borrowed most of the design from it.


Yeah, I’ve used XState previously and it’s a great library, but in the end I went with an implementation that’s closer to the SCXML standard because SCION project has a great test suite ( which I was able to port, and it ensured that the algorithm is correct for more complex transitions

Lucy Wang12:10:34

Great to know these projects like dativity, lots of food for thought! > implementation that’s closer to the SCXML standard because SCION project has a great test suite XState doesn't use scxml-like syntax but this doesn't prevent it to My lib doesn't put conforming to SCXML as a top priority, but focus mostly on what I need in real world projects. For example I need delayed transitions, eventless transitions (transient states), first-class re-frame integration, so I implemented these features. OTOH so far I don't see any need for history states, so I just leave it out.

Lucy Wang12:10:32

Just created the #statecharts channel so people interested could talk there


The re-frame integration looks really interesting, especially the epoch support. Thanks!


really interesting links in here, thanks for the inspo! 👍


Clojure tools is now available: • Make edn reading tolerant of unknown tagged literals • Update to latest dependencies for maven-resolver and aws-api