Questions tagged [clojure-java-interop]

For topics related to interoperability between Clojure and Java

Programs written in Java and in Clojure run on the JVM and can therefore call each other. Use this tag to mark questions related to this interoperability.

269 questions
0
votes
1 answer

Resolve a Clojure string to a Java static member

In the past I've been able to, e.g. ==> ((resolve (symbol "first")) [1 2 3]) 1 but it doesn't seem to work in the same way for a Java static member. Like for instance I have an enum like this in its own file: import…
tjb1982
  • 2,257
  • 2
  • 26
  • 39
0
votes
1 answer

Mixing definterface and defprotocol

I try to implement interface representing arithmetic expressions. The interface will be used by java-side but the whole logic is on clojure. Having: (defprotocol ExtendsExpression (toTree [this])) (extend-type String ExtendsExpression (toTree…
Lambder
  • 2,953
  • 1
  • 26
  • 20
0
votes
1 answer

To write a downloader, Clojure.java.io or Java's io api?

I am trying to write a general http/ftp file downloader in Clojure. I did a little research and found that I can either use java's api -- BufferedReader BufferedInputStream etc, or Clojure.java.io's api -- writer, reader, input-stream,…
Jay Somedon
  • 1,068
  • 11
  • 27
0
votes
1 answer

Clojure Java Interop - reference to field ... can't be resolved

I am working on a clojure project where I want to create a class in Java and then instantiate that class and call a method from within my clojure code. My Java code is located in resources/MyClass.java public class MyClass { public static long…
David Williams
  • 8,388
  • 23
  • 83
  • 171
0
votes
1 answer

How to add image background to JTable in clojure

I wrote this program in clojure to add background image to a JTable. I am stuck with the prepareRenderer function. It seems like clojure cannot handle the first parameter rd (equivalent Java TableCellRenderer rd). I might have done it all wrong here…
-1
votes
1 answer

Could not locate proj/core.clj on classpath when calling clojure from java

I am trying to call some Clojure code from Java, but I get this error when trying to "require" the file: Could not locate proj/core__init.class, proj/core.clj or proj/core.cljc on classpath. at clojure.lang.RT.load(RT.java:462) at…
Ghosty Frosty
  • 159
  • 2
  • 12
-1
votes
3 answers

Looking for a way to partition date on a monthly basis in Clojure

Want to split a date range into monthly chunks. example Input - [10/20/2019 - 12/20/2019] example output - { [10/20/2019 10/31/2019] [11/01/2019 11/30/2019] [12/012019 12/20/2019] } Thank you
Rishin S Babu
  • 1,553
  • 3
  • 13
  • 16
-1
votes
3 answers

Using Java hashmaps in Clojure

I am new to Clojure. I am trying to use java hashmap in clojure. I am passing a java hashmap to Clojure. The map is- {0=Goa, 1=Delhi, 2=Mumbai}. When I am trying to use the clojure functions on this map I am not getting the expected output. In…
ditri
  • 31
  • 3
-1
votes
1 answer

Clojure Java Interoperability

I am new to Clojure. I am trying to understand clojure java interop. I have a java hashmap which I need to use in my Clojure program. I am trying to iterate on the hash map but it is giving me an error. Main.java: package com.example; import…
ditri
  • 31
  • 3
-1
votes
1 answer

Compare values in a list of maps in clojure

I have a list of maps like (def listofmaps ({:directory_path "/some/path/1", :directory_size "8.49 GB"} {:directory_path "/user/dod/yieldbook/yb_sec_char", :directory_size "14.1 MB"}) containing many values and size can be in gb or…
-2
votes
2 answers

best performing dispatch on var value in clojure

In Clojure, it is not possible to use Case forms with Vars: (case (resolve 'inc) #'inc 1) Execution error (IllegalArgumentException) at user/eval2061 (REPL:1). No matching clause: #'clojure.core/inc But I could use a hash-map or a (condp = ...)…
erdos
  • 3,135
  • 2
  • 16
  • 27
-2
votes
1 answer

Don't know how to create ISeq from: clojure.lang.Var error

This is the code I write for ant looking for food genetic program. This is the first day I try to learn clojure, clojush, push. When I try to run this code, I get CompilerException java.lang.IllegalArgumentException: Don't know how to create ISeq…
-3
votes
1 answer

how to implement any genetic ant finding food in Push,Clojush,Clojure?

I am trying to use Push,Clojush,Clojure to implement an ant finding food in a 2d map, but I am not sure how to represent map? Could someone give me a example? Thank you.
-3
votes
2 answers

Pass abstract/null variables into functions Clojure

I have a function that i need to take in a word and im trying to make a variable x the sorted version of word variable. Im not sure how i go about doing this... i am trying to pass it in as a parameter for a function but not working. How do i pass…
Bean Shares
  • 49
  • 1
  • 6
1 2 3
17
18