guillermo ithier

Greenhorn
+ Follow
since Oct 27, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by guillermo ithier

Gary Deer wrote:I have a small Java program that I'm trying to rewrite in Clojure little by little. The first piece I wanted to convert was my logging. I used log4j and I saw a blog post about writing logging in Clojure with log4j, but I didn't see anything about using that for logging in the Java code.

But before I did all that I wanted to see if I could write a simple Clojure file that had functions I could call from a Java program. It was not as easy as I thought it would be. First there were the form considerations (gen-class deftype, defrecord, etc.) then the namespace issues, then aot fun, and after all that, the java classes won't compile. I also tried using leiningen which only made it worse somehow.

With Java interoperability there is a lot to consider. Like if I were to use gen-class for parts to maintain interop with Java parts and then I rewrite those parts in Clojure, will I then need to go back and rewrite the whole thing removing all the interop mess?

I'm in a weird position of trying to create a practical example from a trivial program. But, when I tell people that Clojure has great interoperability with Java, I would like to show them an example of Clojure calling Java and Java Calling Clojure in harmony. Even better if I could give someone a jar that is Clojure files packaged by leiningen that they can use without even knowing it was all written in Clojure.

I'm hoping that the more I play around with it, the more it will click, but as of right now I feel like I'm shaving a yak.


Hello all, This is my first time scripting with clojure. i am using eclipse and when irun the code above, I keep getting greet not recognized. what can I do? Thankyou.
10 years ago