beginners

Getting started with Clojure/ClojureScript? Welcome! Also try: https://ask.clojure.org. Check out resources at https://gist.github.com/yogthos/be323be0361c589570a6da4ccc85f58f.
stagmoose 2021-07-05T15:37:21.498500Z

I tried to follow the instruction from https://github.com/juxt/edge/tree/master/examples/tutorial.vent (I modified cd edge/tutorial.vent to cd edge/examples/tutorial.vent because the path in the doc is wrong) When I run $ ../bin/rebel --cljs -A:dev:build:dev/build , everything is fine and it showed a REPL. But when I enter (go) in the REPL, I got this error. How could I fix this.

Karo 2021-07-05T15:51:47.001300Z

Hi team, how can I create Java local date time in clojure for the given time? #object[java.time.LocalDateTime 0x7af2002a "2021-07-05T15:49:30.051"]

2021-07-05T15:52:54.001400Z

Did you load the file up into the REPL?

2021-07-05T15:59:34.002100Z

@vnazaryan OK you want to produce a LocalDateTime - what is the input you are getting to produce it from?

2021-07-05T16:01:30.002300Z

eg.

user=> (java.time.LocalDateTime/of 2020 7 5 9 1)
#object[java.time.LocalDateTime 0x737edcfa "2020-07-05T09:01"]

2021-07-05T16:01:38.002600Z

if you have all the individual values as numbers

2021-07-05T16:02:39.003300Z

anyway, your solution probably exists somewhere in the javadoc for LocalDateTime, it took me a minute and a half to figure that out from the page

2021-07-05T16:03:37.003800Z

@vnazaryan if you are unfamiliar with Java interop, I recommend checking this guide: https://clojure.org/reference/java_interop.

stagmoose 2021-07-05T16:13:23.003900Z

@https://app.slack.com/team/U07SWUQTH no. First, I switch to the path edge/examples/tutorial.vent in terminal. And execute ../bin/rebel --cljs -A:dev:build:dev/build , which will bring up a REPL, then I enter (go)

stagmoose 2021-07-05T16:14:10.004300Z

and error showed up after (go)

Karo 2021-07-05T16:22:54.004900Z

@noisesmith @pavel.klavik thanks a lot

🍻 2
bigos 2021-07-05T16:53:58.007200Z

I have deps.edn with :paths ["src" "resources" "../reportgenerator/build/web/WEB-INF/classes"] . In the classes folder I have itils folder and in it I have several classes that I want to import into clojure project. I import it like this (:import (utils Result SalXmlDocument Sample)) , but that gives me errors :clojure.error/class java.lang.ClassNotFoundException, :clojure.error/cause "java.lang.SalXmlDocument"},

bigos 2021-07-05T16:54:01.007400Z

why?

seancorfield 2021-07-05T16:56:13.008900Z

@ruby.object Having :paths outside your project like that is deprecated (and will be disallowed), so that is not a solution.

bigos 2021-07-05T16:56:50.009400Z

what can i do to accecc the tree of java classes?

2021-07-05T16:57:25.009800Z

i'm not sure myself, does the :local path key support that?

bigos 2021-07-05T16:57:36.010200Z

is symbolic link good enough?

bigos 2021-07-05T16:58:48.010800Z

what are the options? how can I do a non trivial java interop?

2021-07-05T16:59:46.011700Z

there might be a very good reason, i just haven't run into it or i'm confused, why are your class files not in a jar?

1
bigos 2021-07-05T17:01:16.013300Z

I have a legacy netbeans app and I was thinking about using it's classes to import to clojure and create a jar file from clojure code to be used by the netbeans app

bigos 2021-07-05T17:01:47.013700Z

is it overly too convluted?

bigos 2021-07-05T17:02:55.015400Z

is it possible to gradually refactor the old app into clojure? or should I quit the job?

bigos 2021-07-06T08:00:11.106900Z

I got it working 🙂 thank you. I am sure I will ask more questions on slack, but I will always remain grateful for your help.

2021-07-05T17:04:51.017600Z

Hey team, I am playing with the slack api. To use their thing, I need to reify the https://github.com/slackapi/java-slack-sdk/blob/ce13f06e99d3b2c9234d871bbb2ebeedb9fdf282/bolt/src/main/java/com/slack/api/bolt/handler/builtin/SlashCommandHandler.java#L9 To do that, I wrote this:

(let [config ;;
        app (App. config)
        server  (SlackAppServer. app)]
    (.command app "/hello"
              (reify SlashCommandHandler
                (apply [this req ctx]
                  (.ack ctx ":wave Hello!"))))
    (.start server))
The error I get is:
[qtp740546585-42] ERROR com.slack.api.bolt.servlet.SlackAppServlet - Failed to handle a request - class java.lang.String cannot be cast to class com.google.gson.JsonElement (java
.lang.String is in module java.base of loader 'bootstrap'; com.google.gson.JsonElement is in unnamed module of loader 'app')                          
java.lang.ClassCastException: class java.lang.String cannot be cast to class com.google.gson.JsonElement (java.lang.String is in module java.base of loader 'bootstrap'; com.googl
e.gson.JsonElement is in unnamed module of loader 'app')
        at consistent_slack.core$_main$reify__1646.apply(form-init998480002803844197.clj:15)
My understanding of reify, is a bit wonky. Any guidance on how I can think about what is happening here, much appreciated!

2021-07-05T17:06:45.017900Z

if you can produce a jar from the netbeans app, then i believe deps should be able to pick it up and use the code. Then you can recompile. But I would wait tell someone with more experience doing this answers. Your question was interesting because i hadn't ever considered the situation.

bigos 2021-07-05T17:08:39.019100Z

this trivial example works

bigos 2021-07-05T17:08:53.019300Z

problems start with real life app

seancorfield 2021-07-05T17:10:46.019800Z

It sounds like you are really more interested in calling into Clojure from the legacy NetBeans app?

seancorfield 2021-07-05T17:11:20.020100Z

(and ultimately replacing the Java code with Clojure, working from the ground up)

seancorfield 2021-07-05T17:13:55.020300Z

ack is here https://github.com/slackapi/java-slack-sdk/blob/master/bolt/src/main/java/com/slack/api/bolt/context/Context.java#L92 and expects JsonElement but you passed a String -- which is what the error says.

👍 2
seancorfield 2021-07-05T17:15:59.020600Z

There are two or three possible approaches but the one I prefer -- because it's how we refactored our legacy app to use Clojure (and then, ultimately, replaced the legacy app completely with Clojure) is to leverage Clojure's Java API https://clojure.org/reference/java_interop#_calling_clojure_from_java

2021-07-05T17:16:48.020900Z

Thanks for the resp Sean! Based on the SlashCommandHandler interface, I thought the context was this: https://github.com/slackapi/java-slack-sdk/blob/ce13f06e99d3b2c9234d871bbb2ebeedb9fdf282/bolt/src/main/java/com/slack/api/bolt/context/builtin/SlashCommandContext.java#L51-L53 which has a ack(String implementation. Am I misunderstanding how above is functioning?

2021-07-05T17:17:04.021200Z

Any reason why the change? We also often have mixed Clojure/Java projects where some Java code-gen runs as part of the Java build and puts generated classes in some folder that are needed for the REPL.

seancorfield 2021-07-05T17:18:31.021600Z

You can start by adding Clojure as a regular dependency on your legacy app -- Clojure is "just" a library, like anything else you're already using in the legacy code. And gradually, as you write more Clojure to replace the Java code, start adding more Clojure libraries as dependencies.

2021-07-05T17:19:04.021900Z

what the heck java

😕 2
seancorfield 2021-07-05T17:19:37.022100Z

You would also need your Clojure project's src folder added to the classpath of your legacy app (so the legacy project could "see" your Clojure code when it is referenced via the Java API).

seancorfield 2021-07-05T17:19:46.022300Z

@ruby.object How does that sound?

2021-07-05T17:20:51.023Z

what does clash command response.builder do

2021-07-05T17:22:15.023200Z

i mean , imagine it tries to build a json from a string

seancorfield 2021-07-05T17:23:32.023400Z

I think the issue here is that those types are available via generics to the Java compiler -- but generic types don't exist in compiled code -- they are erased -- so the information that Clojure has available only has the raw types.

seancorfield 2021-07-05T17:24:04.023600Z

(generics are compile-time polymorphism, effectively, but not actual dynamic polymorphism)

phronmophobic 2021-07-05T17:25:15.023800Z

Most of slack's APIs are just http calls that receive and return json. I would probably ignore their Java library and just interface with their http API

☝️ 3
1
seancorfield 2021-07-05T17:25:51.024200Z

Yes, that's how we interact with Slack from Clojure. Far easier than their ridiculously convoluted Java SDK.

seancorfield 2021-07-05T17:26:54.024500Z

The addition of generics was about when I quit Java. Having spent years on the C++ Standards Committee, working on the specification of templates, I didn't want to deal with a watered down version of that in Java!

seancorfield 2021-07-05T17:29:59.024700Z

I'll defer to @alexmiller to explain with :paths outside a project was deprecated.

2021-07-05T17:34:49.024900Z

Thanks team! > I think the issue here is that those types are available via generics to the Java compiler -- but generic types don’t exist in compiled code -- they are erased -- so the information that Clojure has available only has the raw types. Appreciate the depth Sean. Would love to understand this more. Which type is being erased here? (i.e I am not sure what you mean by “this type is available via generics to the Java compiler”, but not to our compiled code via Clojure) (indeed http api may be best, but am trying to smack a few things together as demo, and ideally would like to get this guy to work. Though yeah — oof — very darn convoluted)

2021-07-05T17:35:48.025200Z

I think of you pass a valid Json string I think it might work. I don't think :hello is valid

bigos 2021-07-05T17:36:24.025400Z

that is what I had in mind. to some extent you confirm my idea. But I am stuck at the clojure being a library of my legacy app. For some hope of success that clojure library has to work and finding the examples is not easy. to have a woking library for the legacy app I need to be able to import some classes.

seancorfield 2021-07-05T17:37:03.025600Z

@stopachka Java generics only exist in the (Java) compiler. They don't exist at runtime -- they're not in the .class files -- which is what Clojure has to work with.

bigos 2021-07-05T17:37:25.025800Z

I had success with trivial app https://github.com/bigos/JavaApplication3 also at some point I was able to import legacy java classes to my clojure app, but for some reason it stopped working.

seancorfield 2021-07-05T17:39:14.026100Z

I know nothing about NetBeans, but the first step will be to add org.clojure/clojure as a dependency to your Java project (with version "1.10.3") and in your existing Java code, try out what I linked to above: referencing some clojure.core functions.

bigos 2021-07-05T17:39:21.026300Z

The problem is calling clojure from java side

bigos 2021-07-05T17:39:24.026500Z

public static String passTheData(SalXmlDocument info) { // use the new class for more talking to clojure hmm.report.foo("hello"); hmm.report.passdata(info);

bigos 2021-07-05T17:39:31.026700Z

hello did work

bigos 2021-07-05T17:39:52.026900Z

but how do i pass to clojure an instance of a class?

bigos 2021-07-05T17:40:02.027100Z

is my strategy correct?

2021-07-05T17:40:12.027300Z

@drewverlee I’m not quite sure I understand:

(.command app "/hello"
          (reify SlashCommandHandler
            (apply [this req ctx]
              (.ack ctx ":wave Hello!"))))
Do you mean wrap ":wave Hello!" like this ? "\":wave Hello!\""

seancorfield 2021-07-05T17:40:41.027500Z

Did you read the page I linked, explaining Clojure's Java API?

seancorfield 2021-07-05T17:40:51.027700Z

You can avoid all the gen-class pain.

2021-07-05T17:41:24.027900Z

@seancorfield — wanted to confirm — in this context is the generic “JsonElement”?

seancorfield 2021-07-05T17:41:33.028100Z

No.

bigos 2021-07-05T17:41:35.028300Z

not yet, i will now

seancorfield 2021-07-05T17:41:48.028500Z

The <CTX extends Content> stuff is the generics.

2021-07-05T17:41:58.028700Z

Aha! I see

2021-07-05T17:43:08.029Z

(wait, maybe not — apologies for the noob questions — looking now at where this is written)

bigos 2021-07-05T17:43:37.029200Z

that page does not say what should be the corresponding code on clojure side

2021-07-05T17:44:44.029400Z

I think I understand what you mean, but am not sure where this is happening. https://github.com/slackapi/java-slack-sdk/blob/ce13f06e99d3b2c9234d871bbb2ebeedb9fdf282/bolt/src/main/java/com/slack/api/bolt/context/builtin/SlashCommandContext.java#L24 ^ this says CTX extends Context, but why is this a generic? (I thought this was inheritence)

2021-07-05T17:45:08.029700Z

I was thinking "1", instead of ":hello..."

bigos 2021-07-05T17:45:23.029900Z

https://clojure.github.io/clojure/javadoc/clojure/lang/IFn.html mentions only Objects, how do I pass a hash, or instance of an object

bigos 2021-07-05T17:45:25.030100Z

?

seancorfield 2021-07-05T17:46:07.030500Z

Everything in Java is an Object. You can pass in anything.

seancorfield 2021-07-05T17:46:54.030700Z

And the Clojure code is just regular Clojure code.

bigos 2021-07-05T17:50:29.031Z

so why does medthod give me errors

bigos 2021-07-05T17:50:52.031200Z

:methods [#^{:static true} [foo [String] void] #^{:static true} [ldata [SalXmlDocument] void] #^{:static true} [tryme [Object] void]]

bigos 2021-07-05T17:51:10.031400Z

do i even need to declare the types of arguments

seancorfield 2021-07-05T17:52:38.031600Z

You don't need any of that if you call into Clojure from Java via Clojure's Java API that I linked to.

seancorfield 2021-07-05T17:53:59.031800Z

Generics are compile-time only for Java. They do not exist in the bytecode so no other languages see any of that generic stuff when compiling against Java .class files. I don't know how to say it any differently.

2021-07-05T17:58:43.032100Z

Thanks for bearing with me Sean. What I don’t understand is the following: I don’t see where a generic is written in the source code above.

The &lt;CTX extends Content&gt; stuff is the generics.
Where is this stuff?

bigos 2021-07-05T18:00:56.032600Z

i'll give it a try

2021-07-05T18:01:17.032900Z

Aah! Okay, this makes sense. Thank you!

2021-07-05T18:03:14.033200Z

So if I understand correctly: • The above interface is only understood by java, as it uses generics • From clojure side, it doesn’t know the class of CTX when our SlashCommandHandler runs, and defaults to the base Context type

2021-07-05T18:05:08.033400Z

Okay,

(.command app "/hello"
          (reify SlashCommandHandler
            (apply [this req ctx]
              (let [^SlashCommandContext x ctx]
                (.ack x "hello!")
                )
              )))
The following makes it work! Thanks for bearing with me and for the time @seancorfield @drewverlee

bigos 2021-07-05T18:05:25.033900Z

found good example

2021-07-05T18:28:30.035700Z

Okay, one more esoteric java noob q:

import com.slack.api.methods.response.chat.ChatPostMessageResponse;
import com.slack.api.model.event.ReactionAddedEvent;

app.event(ReactionAddedEvent.class, (payload, ctx) -&gt; {
If I wanted to convert this to clojure, how would I convert passing in ReactionAddedEvent.class ? I am trying:
(.event app
        (class MessageEvent)
        (reify BoltEventHandler
          (apply [this evt ctx]
            (log/info "ctx")
            (log/info ctx))))
But am getting:
{:type java.lang.IllegalArgumentException                                              
   :message Unexpectedly failed to register the handler                                  
   :at [<http://com.slack.api.bolt.App|com.slack.api.bolt.App> event App.java 564]}]     
Which makes me think I am not correctly converting MessageEvent.class https://github.com/slackapi/java-slack-sdk/blob/416ab0415983c42c88ff3b266858462edebf8c91/bolt/src/main/java/com/slack/api/bolt/App.java

bigos 2021-07-05T18:31:11.035900Z

question how to do it with deps edn

2021-07-05T18:39:16.037300Z

@stopachka (class MessageEvent) should be just returns Class , you actually want MessageEvent which is the clojure equivalent of java's MessageEvent.class

2021-07-05T18:39:40.037600Z

eg.

(ins)user=&gt; (class Number)
java.lang.Class
(ins)user=&gt; Number
java.lang.Number

2021-07-05T18:40:20.038200Z

it's a good example of boilerplate elimination I think, what would Number be other than the class Number?

alexmiller 2021-07-05T18:41:41.038900Z

Having generated classes in a folder is fine, it should just be a folder inside the project

2021-07-05T18:42:09.039600Z

I'm wondering now whether there's any value other than nil that returns something other than Class from (comp class class)

2021-07-05T18:42:28.039800Z

probably nothing

alexmiller 2021-07-05T18:42:45.039900Z

Accessing arbitrary paths outside the project root is a potential security issue and the Clojure CLI will currently print a warning if you do this (and eventually we plan to error in this case)

1
2021-07-05T18:43:53.040300Z

user=&gt; (into #{} (map (comp class class))
              [nil 1 Number "" String Double/NaN 'foo])
#{nil java.lang.Class}

seancorfield 2021-07-05T18:52:02.040700Z

No, you don't want deps.edn for this: just add Clojure to your existing Java project. You'll use whatever tool your Java project uses to build the Java code already.

seancorfield 2021-07-05T18:52:40.040900Z

Woohoo! 🙂

🔥 1
1
1
seancorfield 2021-07-05T18:54:07.041100Z

You know how to build the existing NetBeans Java project, yes @ruby.object?

seancorfield 2021-07-05T18:54:33.041300Z

And you have a list of its current dependencies in some NetBeans config?

bigos 2021-07-05T18:54:54.041500Z

i can find it

bigos 2021-07-05T18:56:05.041700Z

i have a project.xml file with jar dependencies

seancorfield 2021-07-05T18:57:06.041900Z

Excellent! So you can add Clojure to that.

bigos 2021-07-05T18:57:22.042100Z

how do i do it?

bigos 2021-07-05T18:57:52.042300Z

because at the moent i was using clojurte to create jar file

seancorfield 2021-07-05T18:58:11.042500Z

Your project.xml has sections like this?

&lt;groupId&gt;javax.media&lt;/groupId&gt;
  &lt;artifactId&gt;jmf&lt;/artifactId&gt;
  &lt;version&gt;2.1.1e&lt;/version&gt;

seancorfield 2021-07-05T18:58:59.042700Z

Clojure is "just" a dependency like:

&lt;groupId&gt;org.clojure&lt;/groupId&gt;
  &lt;artifactId&gt;clojure&lt;/artifactId&gt;
  &lt;version&gt;1.10.3&lt;/version&gt;

seancorfield 2021-07-05T18:59:39.042900Z

And you should be able to rebuild your Java project and it will add Clojure to it.

bigos 2021-07-05T18:59:43.043100Z

<library dirs="200"> <file>${file.reference.mockito-all-1.10.16.jar}</file> <path-in-war>WEB-INF/lib</path-in-war> </library>

bigos 2021-07-05T18:59:59.043300Z

i was looking in the wrong place, one moment please

bigos 2021-07-05T19:00:58.043500Z

mind you it's netbeans 8 😞

seancorfield 2021-07-05T19:01:06.043700Z

The NetBeans UI probably has an option somewhere to "add dependency" if you're used to doing it that way...

seancorfield 2021-07-05T19:01:20.043900Z

(like I say, I have never used NetBeans...)

bigos 2021-07-05T19:03:52.044600Z

well i use ant

bigos 2021-07-05T19:03:57.044900Z

it is so old

seancorfield 2021-07-05T19:04:26.045100Z

Well, something somewhere in the project has to have the list of dependencies. When you find that, you can add Clojure to it.

bigos 2021-07-05T19:04:57.045300Z

i foud a dialog for it

2021-07-05T19:05:21.045900Z

ah, makes a loot of sense! Thanks @noisesmith, and clojure ftw!!

bigos 2021-07-05T19:06:51.046Z

bigos 2021-07-05T19:07:51.046200Z

and it leads to the jar dialog

bigos 2021-07-05T19:14:39.046600Z

has the option to download the jar file, I'm back on track

2021-07-05T19:18:25.046800Z

I'm not familiar with Edge and this particular tutorial you're following. However, for the REPL to do anything useful like starting a project, you need to evaluate some code inside of it. Are you connected to the REPL through your code editor? If so, navigate to the file where the go function is defined and evaluate that file. Then the go function will be accessible inside your REPL.

2021-07-05T19:24:39.047200Z

I read some about Edge, have you seen this particular section in the docs? https://www.juxt.land/edge/docs/dev-guide.html#_starting_your_system

seancorfield 2021-07-05T19:54:49.047400Z

That will not work. You need to specify Clojure as a dependency not a downloaded library.

seancorfield 2021-07-05T19:55:25.047600Z

Clojure itself depends on two other libraries. Downloading the JAR will not give you those libraries so your code will fail (in ways you will find hard to debug).

seancorfield 2021-07-05T19:55:57.047800Z

Please figure out how to add dependencies to your Java project and add Clojure that way.

bigos 2021-07-05T20:11:30.048100Z

so does that mean that i need to find ways to convert the project to maven first?

seancorfield 2021-07-05T20:13:36.048300Z

As I keep saying, I know nothing about NetBeans. Somehow, somewhere, your existing Java project must have a way of declaring/specifying its existing dependencies. Those are being fetched from Maven. Clojure is on Maven. So you can add Clojure as a dependency to the existing Java project somehow and that's all you need.

seancorfield 2021-07-05T20:15:42.048500Z

NetBeans itself definitely lets you add new dependencies to a project (not JAR files, not class libraries, actual dependencies). You need something that understands Maven-style dependencies to fetch Clojure for you, so that transitive dependencies are also fetched.

seancorfield 2021-07-05T20:16:04.048700Z

Who built this project in the first place? Can you ask them about adding a dependency?

seancorfield 2021-07-05T20:16:32.048900Z

(since you said "or should I quit the job?" I assume you have colleagues you can ask about this project)

bigos 2021-07-05T20:16:32.049100Z

they no longer work here

bigos 2021-07-05T20:17:07.049300Z

the company is interviewing a java programmer this week I am not a java programmer

seancorfield 2021-07-05T20:18:08.049500Z

Well, then you're probably not going to be able to mix Clojure and Java if you can't find out or figure out how to add Maven-style dependencies to that existing project, sorry.

seancorfield 2021-07-05T20:18:37.049800Z

Once they hire a Java programmer, there will be someone who can set that up for you.

bigos 2021-07-05T20:19:06.050Z

I'm sure there are a lot of legacy projects that would benefit from clojure, but why is is so hard, are people so fed up with the old projects so that they rewrite them from scratch?

seancorfield 2021-07-05T20:19:33.050200Z

It isn't hard. It just assumes some knowledge about the Java ecosystem which you don't have, unfortunately.

bigos 2021-07-05T20:19:46.050400Z

thank you very much for your help, especially for your deps.edn that I regularly copy

bigos 2021-07-05T20:20:02.050600Z

have a good night

seancorfield 2021-07-05T20:20:06.050800Z

Sorry I can't really help you with this 😞

bigos 2021-07-05T20:20:21.051Z

you are not the first one

bigos 2021-07-05T20:20:34.051200Z

usually people give up much sooner

seancorfield 2021-07-05T20:20:45.051400Z

Haha... OK, fair enough.

bigos 2021-07-05T20:21:46.051600Z

I have emailed my boss saying i am making progress. i will have some explaining tomorrow

seancorfield 2021-07-05T20:21:48.051800Z

If it was publicly accessible, I could probably dig into it some more, but right now I don't even know what to suggest you look for in the project (since I gather it doesn't have pom.xml which would be the telltale sign of Maven?).

seancorfield 2021-07-05T20:22:38.052Z

Is the build.xml file just running javac with no dependency management stuff in place at all?

seancorfield 2021-07-05T20:23:09.052200Z

(I can't imagine the code uses no external libraries at all but I suppose that is technically possible)

bigos 2021-07-05T20:23:30.052400Z

$ tree ./nbproject/ ./nbproject/ ├── ant-deploy.xml ├── build-impl.xml ├── build-impl.xml~ ├── genfiles.properties ├── private │   ├── private.properties │   └── private.xml ├── project.properties ├── project.xml └── rest-build.xml

bigos 2021-07-05T20:23:32.052600Z

$ ls ./*.xml ./build.xml

bigos 2021-07-05T20:24:16.052800Z

jacekp@EID6043:~/code/AAA-java/reportgenerator$ tree ./lib/ ./lib/ ├── bcmail-jdk15on-1.67.jar ├── bcpg-jdk15on-1.67.jar ├── bcpkix-jdk15on-1.67.jar ├── bcprov-jdk15on-1.67.jar ├── cds.astro.jar ├── clojure-1.10.2.jar ├── commons-lang-2.6.jar ├── core-renderer-R8.jar ├── javacsv.jar ├── javax.mail-1.6.2.jar ├── lidlcsvreport.jar ├── mockito-all-1.10.16.jar ├── multipart.jar ├── opencsv-5.1.jar ├── openpdf-1.3.23.jar └── unbescape-1.1.6-SNAPSHOT.jar

bigos 2021-07-05T20:24:33.053Z

the code is 10-15 years old

seancorfield 2021-07-05T20:25:12.053200Z

Out of curiosity, what version of Java is it running with?

bigos 2021-07-05T20:25:57.053500Z

$ tree -d ./src/ ./src/ ├── conf └── java ├── emailing ├── exceptions ├── sal │   ├── calculations │   ├── reports │   │   ├── animal_feed │   │   ├── content_producers │   │   ├── micro │   │   └── tools │   ├── stamps │   └── user_options ├── servlets ├── utils └── xml └── regulatory_methods

bigos 2021-07-05T20:26:13.053700Z

$ java -version java version "1.8.0_162" Java(TM) SE Runtime Environment (build 1.8.0_162-b12)

bigos 2021-07-05T20:26:35.053900Z

src folder has dozens of classes in the src folder

seancorfield 2021-07-05T20:26:49.054100Z

At least you're on Java 8 🙂

bigos 2021-07-05T20:26:58.054300Z

barely

seancorfield 2021-07-05T20:27:27.054500Z

OK, so since you've gotten as far as manually downloading Clojure 1.10.2, here are the other libs you'll need to download to at least move forward:

org.clojure/clojure 1.10.2
  . org.clojure/spec.alpha 0.2.194
  . org.clojure/core.specs.alpha 0.2.56

seancorfield 2021-07-05T20:28:39.054700Z

If you download those manually from Maven, like you did for Clojure, and put them in lib, you should at least be able to try the Java -> Clojure calls into clojure.core per the example linked somewhere above.

seancorfield 2021-07-05T20:29:08.054900Z

It'll be painful to add any new Clojure libraries or update Clojure etc but it should at least get you to a working state for something basic.

seancorfield 2021-07-05T20:31:08.055200Z

Then, in some Java code in the project, you should be able to import clojure.java.api.Clojure; and import clojure.lang.IFn; and then do this:

IFn plus = Clojure.var("clojure.core", "+");
plus.invoke(1, 2);

seancorfield 2021-07-05T20:33:24.055400Z

As for writing your own Clojure code and being able to require and invoke that, you'll need your (Clojure) src folder to be on the project's classpath but I'm sure where to suggest putting that or how to configure the app to add it...

seancorfield 2021-07-05T20:35:12.055600Z

In the Java code you could call System.getProperty( "java.class.path" ); to see what is on the current classpath and maybe there's an "obvious" safe place to put your src folder in some directory on that classpath...?

bigos 2021-07-05T20:35:34.055900Z

no error bu bnothing is printed

bigos 2021-07-05T20:36:37.057300Z

i guess i can try to figure it out later

bigos 2021-07-05T20:37:08.058Z

you think about the question i was asking myself about the src for clojure

seancorfield 2021-07-05T20:37:13.058300Z

I expect you'd have to log the result or print it -- however the current project writes stuff to a console log...

bigos 2021-07-05T20:37:29.058700Z

sadly i do not know where to star and I need to call it a day

seancorfield 2021-07-05T20:37:37.059Z

That getProperty() call is just going to return a string.

seancorfield 2021-07-05T20:37:52.059400Z

OK, well, good luck tomorrow. We'll be here 🙂

bigos 2021-07-05T20:37:56.059600Z

ant -f /home/jacekp/code/AAA-java/reportgenerator -Djavac.includes=servlets/GeneratorServlet.java -Dnb.internal.action.name=debug.single -Ddirectory.deployment.supported=false -DforceRedeploy=false -Dbrowser.context=/home/jacekp/code/AAA-java/reportgenerator/src/java/servlets/GeneratorServlet.java -Ddebug.class=servlets.GeneratorServlet debug-single-main init: deps-module-jar: deps-ear-jar: deps-jar: compile-single: Generating Report - ReportID : 1388907 - Report Type : +44 - UserName : jacekp - Location : Concept Loading KeyStore File URL: http://localhost:10000/xml/report/generate/1388907Converting stream to string Starting loading groups from XML group = Pesticide Screen (GC CSOPP611 & LC CSOPP603 Reg) group = Fosetyl-Al (sum fosetyl + phosphorous acid and their salts, express as fosetyl) group = Miscellaneous group = Miscellaneous group = Pesticide Screen (GC CSOPP611 & LC CSOPP603 Reg) Finished Loading Groups from XML Report Unit : 1' : kg Report Unit : 3' : mg for 5 : null Parsing new report : before trying clojure after trying clojur

Maxime D 2021-07-05T20:38:22.059900Z

Hi everyone. Brand new to Clojure and can't stop reading for the last two weeks. Interested to start a SaaS (learning) project with Clojure and was wondering if it is considered OK to use Vue or React without going the SPA road. A bit like adding some React or Vue components only in the html templates (using Semler). I guess it is possible but would like to hear about your experiences.

bigos 2021-07-05T20:39:21.060100Z

public static String passTheHash(SalXmlDocument info) { System.out.println("before trying clojure"); IFn plus = Clojure.var("clojure.core", "+"); plus.invoke(1, 2); System.out.println("after trying clojure");

seancorfield 2021-07-05T20:40:01.060400Z

System.out.println( plus.invoke(1, 2) );

seancorfield 2021-07-05T20:40:12.060600Z

Then at least you should see the result printed 🙂

bigos 2021-07-05T20:40:48.060800Z

before trying clojure 3 after trying clo

bigos 2021-07-05T20:40:56.061Z

🙌

bigos 2021-07-05T20:41:20.061200Z

now how do i invoke real clojure code?

seancorfield 2021-07-05T20:41:46.061400Z

Well, you have to figure out how to add a src folder to the app's classpath somehow.

seancorfield 2021-07-05T20:42:14.061600Z

Then you just write your Clojure code in that folder, and use var/`require` to make it accessible to Java.

bigos 2021-07-05T20:42:27.061800Z

i just had idea

bigos 2021-07-05T20:42:37.062Z

i will just commit what i have so far

bigos 2021-07-05T20:42:47.062200Z

i do not want to lose your precious code

seancorfield 2021-07-05T20:43:38.062400Z

IFn require = Clojure.var("clojure.core", "require");
require.invoke("your.namespace");
IFn yourFunc = Clojure.var("your.namespace","your-func");
yourFunc.invoke(...);

bigos 2021-07-05T20:44:51.062600Z

do i put the hole project?

bigos 2021-07-05T20:45:15.062800Z

lidlcsvreport$ tree . ├── CHANGELOG.md ├── classes │   └── sal │   └── reports │   └── LIDL_Pesticide_Report.class ├── copy-java-classes ├── deps.edn ├── doc │   └── intro.md ├── LICENSE ├── lidlcsvreport.jar ├── pom.xml ├── README.md ├── http://README.org ├── resources ├── src │   └── sgs │   └── lidlcsvreport.clj └── test └── sgs └── lidlcsvreport_test.clj

bigos 2021-07-05T20:45:39.063Z

or just src of the clojure project?

seancorfield 2021-07-05T20:45:58.063200Z

Start small. Start by just adding a src folder and some simple code and make sure you can call it.

seancorfield 2021-07-05T20:46:20.063400Z

Remember that this is a Java project: the deps.edn etc is irrelevant.

bigos 2021-07-05T20:46:32.063600Z

I SEE!!!

bigos 2021-07-05T20:46:39.063800Z

i did not know that

seancorfield 2021-07-05T20:46:52.064Z

You're not building Clojure to a JAR or compiling it to classes.

bigos 2021-07-05T20:47:05.064200Z

perhaps i shold remove the jar cleated by deps.edn

seancorfield 2021-07-05T20:47:22.064400Z

You're using Clojure source code inside the Java project, and relying on the require invocation to load and compile it.

bigos 2021-07-05T20:49:44.064600Z

in netbeans i hace sources dialog with src and test declared

bigos 2021-07-05T20:49:53.064800Z

maybe this is the way out

seancorfield 2021-07-05T20:50:19.065Z

I don't think so. For a Java project, that's just where to find the Java source code -- it's not about the classpath.

seancorfield 2021-07-05T20:51:25.065200Z

System.out.println( System.getProperty( "java.class.path" ) );
^ that in your Java code will print out what the class path is when the Java code runs.

bigos 2021-07-05T20:52:41.065400Z

i have created clojure-src folder at the root of java project and uses the properties/sources dialog to add it to the project

seancorfield 2021-07-05T20:54:04.065600Z

I don't think that will work because I don't think that will affect the classpath.

bigos 2021-07-05T20:54:34.065800Z

claspath is void

bigos 2021-07-05T20:54:42.066Z

do i need to import systemk?

seancorfield 2021-07-05T20:55:03.066200Z

What does System.out.println( System.getProperty( "java.class.path" ) ); print?

bigos 2021-07-05T20:57:21.066400Z

before classpath /home/jacekp/code/AAA-java/reportgenerator/build/web/WEB-INF/classes:/home/jacekp/code/AAA-java/reportgenerator/lib/bcmail-jdk15on-1.67.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/bcpg-jdk15on-1.67.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/bcpkix-jdk15on-1.67.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/bcprov-jdk15on-1.67.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/cds.astro.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/commons-lang-2.6.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/core-renderer-R8.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/javacsv.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/javax.mail-1.6.2.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/mockito-all-1.10.16.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/multipart.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/opencsv-5.1.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/openpdf-1.3.23.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/unbescape-1.1.6-SNAPSHOT.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/clojure-1.10.2.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/core.specs.alpha-0.2.56.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/spec.alpha-0.2.194.jar:/home/jacekp/netbeans-8.2rc/enterprise/modules/ext/jaxrs-2.0/javax.ws.rs-api-2.0.jar:/home/jacekp/apps/jboss-5.1.0.GA/common/lib/jboss-javaee.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/endorsed/activation.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/endorsed/jaxb-api.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/endorsed/jbossws-native-jaxrpc.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/endorsed/jbossws-native-jaxws-ext.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/endorsed/jbossws-native-jaxws.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/endorsed/jbossws-native-saaj.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/endorsed/resolver.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/endorsed/serializer.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/endorsed/stax-api.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/endorsed/xalan.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/endorsed/xercesImpl.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/concurrent.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/dom4j.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/getopt.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/javassist.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jaxb-impl.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jaxb-xjc.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-aop-asintegration-core.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-aop-asintegration-jmx.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-aop-asintegration-mc.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-aop-deployers.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-aop-jboss5.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-aop-mc-int.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-aop.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-bootstrap.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-classloader.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-classloading-spi.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-classloading-vfs.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-classloading.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-common-core.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-dependency.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-deployers-client-spi.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-deployers-client.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-deployers-core-spi.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-deployers-core.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-deployers-impl.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-deployers-spi.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-deployers-structure-spi.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-deployers-vfs-spi.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-deployers-vfs.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-j2se.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-jmx.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-kernel.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-logbridge.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-logging-jdk.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-logging-log4j.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-logging-spi.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-logmanager.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-main.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-managed.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-mbeans.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-mdr.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-metatype.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-profileservice-spi.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-reflect.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-system-jmx.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-system.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-vfs.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/jboss-xml-binding.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/log4j-boot.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/osgi.core.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/trove.jar:/home/jacekp/apps/jboss-5.1.0.GA/lib/wstx.jar:/home/jacekp/apps/jboss-5.1.0.GA/common/lib/jbossws-native-jaxws-ext.jar:/home/jacekp/apps/jboss-5.1.0.GA/common/lib/ejb3-persistence.jar:/home/jacekp/apps/jboss-5.1.0.GA/common/lib/mail.jar:/home/jacekp/apps/jboss-5.1.0.GA/common/lib/el-api.jar:/home/jacekp/apps/jboss-5.1.0.GA/common/lib/jbossws-native-jaxrpc.jar:/home/jacekp/apps/jboss-5.1.0.GA/common/lib/jbossws-native-saaj.jar:/home/jacekp/apps/jboss-5.1.0.GA/common/lib/jbossws-native-jaxws.jar:/home/jacekp/apps/jboss-5.1.0.GA/common/lib/servlet-api.jar:/home/jacekp/apps/jboss-5.1.0.GA/common/lib/hibernate-entitymanager.jar:/home/jacekp/apps/jboss-5.1.0.GA/common/lib/jsp-api.jar:/home/jacekp/apps/jboss-5.1.0.GA/common/lib/jboss-jsr77.jar:/home/jacekp/apps/jboss-5.1.0.GA/server/default/deployers/ejb3.deployer/jboss-ejb3-deployer.jar:/home/jacekp/apps/jboss-5.1.0.GA/server/default/deployers/ejb3.deployer/jboss-ejb3-iiop.jar:/home/jacekp/apps/jboss-5.1.0.GA/server/default/deploy/jbossweb.sar/jsf-libs/jsf-api.jar:/home/jacekp/apps/jboss-5.1.0.GA/server/default/deploy/jbossweb.sar/jsf-libs/jsf-impl.jar:/home/jacekp/apps/jboss-5.1.0.GA/server/default/deploy/jbossweb.sar/jstl.jar after classpat

seancorfield 2021-07-05T20:57:32.066600Z

Thanks. Just a sec...

bigos 2021-07-05T20:57:39.066800Z

lots of jboss

seancorfield 2021-07-05T20:59:22.067Z

Hmm, so /home/jacekp/code/AAA-java/reportgenerator/build/web/WEB-INF/classes is the only actual folder on the classpath...

bigos 2021-07-05T21:00:34.067200Z

that is where the classes appear when I press compile button

seancorfield 2021-07-05T21:01:07.067400Z

Yeah, expected. I was hoping for some other folder where you could safely put Clojure source code 🙂

seancorfield 2021-07-05T21:05:28.067600Z

When we were adding Clojure to our legacy app, we edited the app's config to add an additional folder to the classpath at startup (our Clojure src folder).

seancorfield 2021-07-05T21:07:05.067800Z

Do you always run the project via ant like that? Or does it normally run as a web app?

bigos 2021-07-05T21:10:40.068Z

its a web app when it's deployed

seancorfield 2021-07-05T21:10:55.068200Z

OK, so ant is just for testing it?

bigos 2021-07-05T21:10:57.068400Z

but i use mockito to cheat around that

bigos 2021-07-05T21:11:09.068600Z

mockito is for testing

bigos 2021-07-05T21:11:27.068800Z

ant is for buildung war file that is rsynced to the server

seancorfield 2021-07-05T21:12:07.069Z

It looked like you were using ant to actually run the code for testing that the Clojure invocation worked.

bigos 2021-07-05T21:12:15.069200Z

public static void main(String[] args) throws ServletException, FileNotFoundException, IOException, MissingValuesException, NoSuchAlgorithmException, CertificateException, KeyStoreException { HttpServletRequest request = mock(HttpServletRequest.class); HttpServletResponse response = mock(HttpServletResponse.class); // insert parameters here // when(request.getParameter("reportid")).thenReturn("1366796"); when(request.getParameter("reportid")).thenReturn("1388907")

seancorfield 2021-07-05T21:12:32.069400Z

Right, and that's the "single-debug-main"?

bigos 2021-07-05T21:13:11.069600Z

yes, almost some classes have their debug mains

bigos 2021-07-05T21:17:56.070100Z

could that be a clue?

seancorfield 2021-07-05T21:18:42.070300Z

I wouldn't bother trying to follow something so old.

seancorfield 2021-07-05T21:23:17.070500Z

If you have a small, simple Clojure project, you can ask Clojure to compile a namespace to .class files in a specific target directory from the REPL:

user=&gt; (binding [*compile-path* "/home/jacekp/code/AAA-java/reportgenerator/build/web/WEB-INF/classes"]
          (compile "your.namespace"))
That would let you write Clojure in a separate folder, and compile it into that classes folder so it would be accessible to the Java code (via the var/`invoke` calls).

seancorfield 2021-07-05T21:27:05.070700Z

What I'm trying to help you avoid is having to write all the gen-class stuff since that's so painful and also it requires the compiled Java classes to be on your Clojure classpath -- which would mean your Clojure project would have to live in that same tree so it could be on your :paths. Code compiled per above, into the WEB-INF/classes folder, would then be on the classpath when the Java code runs so that your Java code could require it -- but I worry that classes folder gets cleaned out each time to build the Java code (which would erase your Clojure code).

seancorfield 2021-07-05T21:28:51.070900Z

You could also build an uberjar of your Clojure project -- without AOT -- and put that in lib (you wouldn't need the Clojure JARs in lib then because Clojure would be in your uberjar) and, again, access the Clojure code via require as above.

bigos 2021-07-05T21:35:40.071100Z

.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/clojure-1.10.2.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/core.specs.alpha-0.2.56.jar:/home/jacekp/code/AAA-java/reportgenerator/lib/spec.alpha-0.2.194.jar:/home/jacekp/code/AAA-java/reportgenerator/src/clojure:/home/jacekp/netbeans-8.2r

bigos 2021-07-05T21:37:20.071300Z

i have :/home/jacekp/code/AAA-java/reportgenerator/src/clojure: in the classpath

bigos 2021-07-05T21:37:37.071500Z

the dialog for adding jars is confusing

bigos 2021-07-05T21:37:47.071700Z

it allows aslo to add folders

borkdude 2021-07-05T21:38:27.071900Z

I don't see a problem with that. I've also made something for pages that need a tiny bit of CLJS, for quickly setting up something, without going through the hoops of setting up a CLJS project first. https://borkdude.github.io/scittle/

👍 1
👀 1
seancorfield 2021-07-05T21:48:03.072600Z

Yay! :thumbsup::skin-tone-2:

seancorfield 2021-07-05T21:48:44.072800Z

So now you can put example.clj unto that src/clojure folder with (ns example) and a function in it, and try requiring/invoking it from the Java code.

seancorfield 2021-07-05T21:49:20.073Z

(baby steps, to verify each new piece works!)

bigos 2021-07-05T21:49:58.073200Z

i tried somethis else and now i will be wiser and will follow the baby steps

bigos 2021-07-05T21:53:27.073400Z

Exception in thread "main" java.lang.IllegalStateException: Attempting to call unbound fn: #'example/requi

bigos 2021-07-05T21:53:38.073600Z

// any other namespace than clojure.core needs to be "required" IFn require = Clojure.var("example", "require"); require.invoke(Clojure.read("example")); IFn foo = Clojure.var("", "foo"); System.out.println(foo.invoke());

bigos 2021-07-05T21:58:46.073800Z

after classpath we have another failure add: null

bigos 2021-07-05T21:59:13.074Z

(ns example) (defn foo [] (println "we have another failure"))

bigos 2021-07-05T21:59:22.074200Z

🙏

bigos 2021-07-05T22:00:07.074400Z

we never agreed on paying you evening rate so I am not expecting to give you lots of money

bigos 2021-07-05T22:00:20.074600Z

but your effort needs some reward

sova-soars-the-sora 2021-07-05T22:17:30.074800Z

😮 clojurescript in the <script> tag!

👀 1
bigos 2021-07-05T22:24:10.075700Z

big thanks to @seancorfield for his help 🙂

❤️ 1
seancorfield 2021-07-05T22:32:02.075800Z

IFn require = Clojure.var("clojure.core", "require"); // this is a core function

seancorfield 2021-07-05T22:32:26.076Z

Then

require.invoke(Clojure.read("example"));
IFn foo = Clojure.var("example", "foo"); // needs the ns for example/foo