This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-15
Channels
- # adventofcode (80)
- # beginners (94)
- # biff (19)
- # cider (74)
- # clj-kondo (11)
- # cljs-dev (7)
- # clojure (110)
- # clojure-austin (3)
- # clojure-australia (1)
- # clojure-belgium (1)
- # clojure-china (1)
- # clojure-europe (83)
- # clojure-filipino (1)
- # clojure-hk (1)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (4)
- # clojure-sg (1)
- # clojure-taiwan (1)
- # clojure-uk (2)
- # cursive (3)
- # data-science (8)
- # datalevin (8)
- # emacs (18)
- # etaoin (5)
- # graalvm (1)
- # holy-lambda (3)
- # honeysql (1)
- # jackdaw (10)
- # java (10)
- # jobs (3)
- # luminus (9)
- # malli (106)
- # off-topic (88)
- # polylith (8)
- # portal (2)
- # re-frame (50)
- # reagent (11)
- # reitit (74)
- # remote-jobs (1)
- # shadow-cljs (46)
- # tools-deps (26)
- # xtdb (49)
When you need to call a Clojure function from Java, is this the easiest way to do it?
IFn require = Clojure.var("clojure.core", "require");
require.invoke(clojure.lang.Symbol.create("stats-clj.special"));
IFn inc = Clojure.var("stats-clj.special", "gamma");
System.out.println(inc.invoke(5));
I found part of it here https://clojure.org/reference/java_interop#_calling_clojure_from_java
But it's not talking about how to actually load custom code.This is the correct way to do it. What does ‘custom code” mean?
With above you can load any namespace and invoke any var
By "custom code" I meant simply loading something outside clojure.core, like the stats-clj.special ns above 🙂 Thanks for confirmation - perhaps it would be a good addition to the .org reference linked above?
I don’t understand what’s different that needs to be added
It says “Functions in clojure.core are automatically loaded. Other namespaces can be loaded via require:”
You can use Clojure.read() instead