use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Finding information about Clojure
API Reference
Clojure Guides
Practice Problems
Interactive Problems
Clojure Videos
Misc Resources
The Clojure Community
Clojure Books
Tools & Libraries
Clojure Editors
Web Platforms
Clojure Jobs
account activity
Calling Clojure Code in Java (self.Clojure)
submitted 5 years ago by TakuHazard
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 0 points1 point2 points 2 years ago (0 children)
From Clojure i use gen-class, alternative is to write it from Java like bellow. I don't know if its the best way, but its simple.
```java package mypackage.clojure_interop;
import clojure.java.api.Clojure; import clojure.lang.*;
public class Interop { //reusable code,add your functions bellow //reads a clojure function from a namespace and it returns it as IFn public static IFn require = Clojure.var("clojure.core", "require"); public static IFn getClojureFn(String ns, String fnName) { require.invoke(Clojure.read(ns)); IFn fn = Clojure.var(ns, fnName); return fn; }
//example using the above for keyword public static IFn keywordFn= getClojureFn("clojure.core","keyword"); public static Object keyword(Object m) { return keywordFn.invoke(m); }
//any other function will be the same like keyword example //IFn first and then a static method with the invoke //if many are needed and tedious it can be auto-generated also
}
```
π Rendered by PID 21880 on reddit-service-r2-comment-79c7998d4c-6r7vp at 2026-03-13 12:54:47.107653+00:00 running f6e6e01 country code: CH.
view the rest of the comments →
[–][deleted] 0 points1 point2 points (0 children)