r/Clojure • u/mtruyens • May 07 '20
Clojure/Script for contracts — showcase of its power
My startup develops an advanced contract drafting platform for lawyers. The startup is entirely built around Clojure and ClojureScript, and I could not have been more happy with that choice. Clojure has allowed me (as the single developer) to build more features than any competitor out there, while keeping the entire editor fully interactive, even for long contracts.
As the latest testament to the fact that Clojure is really a startup's secret weapon, I have recently added Clojure as an embedded programming language, to cover the few advanced clauses/contracts that were not possible to draft before via the native DSL. (I do not expect that there will be many lawyers out there who will use it, but it's an escape hatch that can come in very handy from time to time).
The implementation only took me a few hours, thanks to https://github.com/borkdude/sci
I have added a few playful examples of what is now possible in the three videos below. (The typical use cases are actually quite boring because they typically concern text juggling in long paragraphs, that is not easily visualized — hence the playful videos.)
https://help.clausebase.com/software-updates-may-2020/
By the way, is anyone aware of a tutorial that I can point my users to, that teaches only those Clojure concepts that are relevant for using Clojure as an embedded programming language? Obviously, stuff like REPLs, concurrency, macros etc. are overkill.
Note: I have long doubted whether to post this here, as it kind of qualifies as publicity. But since I assume no Clojure programmer is actually within my natural commercial target audience (lawyers), I hope it's OK.
1
u/TeachUsPlz May 07 '20
That's awesome. Would you recommend lasting clojure (script) without any java(script) background?
1
u/mtruyens May 08 '20
Would you recommend lasting clojure (script) without any java(script) background?
Because Clojure & ClojureScript are so different from traditional, so-called "imperative", programming languages (such as Java, C# and Javascript), it is frequently pointed out that the "un-learning" part is actually a significant hurdle when learning Clojure / ClojureScript.
So from a certain perspective, I can imagine that learning Clojure / ClojureScript as your first programming language would avoid that mental hurdle of the imperative languages having transformed your mental processes.
At the same time, Clojure and ClojureScript are hosted languages: they are not an island, and live in symbiosis with the Java (server) and Javascript (browser) environments. So you can never completely avoid having to deal with Java and Javascript.
Also, the software development tools for Clojure and ClojureScript are great, but setting them up is a well-known pain point. Even though improvements are coming, I think this will be a significant turnoff for a beginning programmer. The mainstream languages have a much larger user base, so that installing your development tools should be much smoother.
3
u/JoppeSchwartz May 07 '20
This looks very cool! Although I’m a clojure programmer who’s also a lawyer, I’m not practicing at the moment, so I think I fall outside your potential customer base.
3
u/vincent-dm May 08 '20
Very cool. Also nice to see a fellow Belgian legal-tech company going all-in on Clojure!
1
u/muhaaa May 08 '20
I saw a presentation of you about your tech stack on youtube. I am impressed about your progress you made since! I think the legal tech space has a lot of potential.
Your product reminds me of https://www.workiva.com/ I think they are successful for automating regulatory filings, like periodical reporting of financial statements.
1
u/Dalton_Channel25 May 08 '20
On a related note, Paul Graham had a similar conclusion about lisp:
It must have seemed to our competitors that we had some kind of secret weapon-- that we were decoding their Enigma traffic or something. In fact we did have a secret weapon, but it was simpler than they realized. No one was leaking news of their features to us. We were just able to develop software faster than anyone thought possible.
[...]
Our secret weapon was similar. We wrote our software in a weird AI language, with a bizarre syntax full of parentheses. For years it had annoyed me to hear Lisp described that way. But now it worked to our advantage. In business, there is nothing more valuable than a technical advantage your competitors don't understand. In business, as in war, surprise is worth as much as force.
0
May 08 '20
what does Clojure give you in your circumstances that another programming language doesn't, giving you the competitive advantage? macros?
1
u/neo2551 May 08 '20
Speed of development?
1
-1
May 08 '20
The question was posed to the author, I should have been clearer.
I bet there is nothing especially good about speed of development in Clojure vs Python or PHP or Ruby.
12
u/mtruyens May 08 '20
Actually it's a mix of many factors:
both the server-side and the client-side can share code (in my software's case, this is crucial, because the contract needs to be shown exactly the same on the screen during editing, and in PDF/DOCX when rendering on the server). This is something that Javascript can also offer, but Python, PHP and Ruby not really.
the interactive REPL allows you to have a very fast write - compile - test - change loop
tools such as Figwheel and Shadow-CLJS allow you to interactively write code for the browser, which is almost immediately updated when you hit Save
the "immutability" by default may seem weird at first, but actually mentally frees you, so that you have to put less stuff in your head
an ecosystem that is just large enough (so that you can easily find all the components you are looking for), but not so large that you are confronted with an overload (cf. the "Javascript fatigue")
Clojure strongly favours composing different libraries instead of using a big framework. Even though setting up these diverse libraries is a bit more work in the beginning (compared to a framework such as e.g. Rails), you can much more easily finetune the end result to fit your exact needs, and swap out components that do not fit your needs
1
u/agumonkey May 10 '20
what languages did you know prior ? you had lisp under your belt or is it the first one ?
interesting return :)
6
u/mtruyens May 08 '20
And I almost forgot — the expressiveness of Clojure: you do not have to write as much code as in other languages. (Compared to Java, it is often said that Clojure code is only 10% to 20% the size of comparable Java code.)
See for example https://www.freecodecamp.org/news/a-real-world-comparison-of-front-end-frameworks-with-benchmarks-e1cb62fd526c/ — even compared to other relatively expressive languages (such as JavaScript), the demo written in the ClojureScript framework has the fewest lines of code.
6
u/kolme May 07 '20
That is pretty rad! If the business booms (which I'm crossing my fingers for) you might want to consider donating to the Dude himself ;-)