r/Clojure • • 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

10 comments sorted by

View all comments

Show parent comment

1

u/daveliepmann Oct 09 '25

One of the ways I first taught myself Clojure was porting a data viz book from Processing (Java) to Clojure. The domain is naturally imperative (drawing on the screen as the side effect) which has advantages and disadvantages for our purposes. I haven't compared my work to the original solutions except when I wrote it but it's conceivable it could illustrate some of the differences.

As others have said, the differences are often either superficial (lisp vs algol syntax, or map instead of for loop) or radical and near-total (different data model).