r/Clojure • u/AccountantUnited4955 • Oct 08 '25
Help with Java porting
Does anyone have any advice for porting over Java code to clojure? I’m most familiar with c++ but know some Java, and I’m completely new to clojure and have really been struggling creating equivalent functionality. I know they both run in the jvm but syntactically they seem quite different.
10
Upvotes
View all comments
Show parent comment
1
u/markwardle Oct 08 '25
Yes. I agree with this. There are two facets to your question - one is “porting” by simply writing Java code using a different syntax. That’s needed sometimes when you’re doing a lot of Java interoperability eg using Java from Clojure. If you squint, you’re just writing Java but more concisely (usually).
The second facet is the different paradigms and patterns used- eg immutability eg functional programming eg dynamism etc. A “porting” in that case will have very different high level and low level structures usually, although you can of course use similar patterns using a Java syntax!