How do I call a Clojure function that takes a two-dimensional array of Strings from Java?

212 views Asked by At

Basically question says it all.

When I declare a function signature in gen-class, what type do I put for a 2D array of strings?

[myFunc [XXXX] ReturnType]

what do I put for XXXX?

Update : following @Mark Topolnik's suggestion, I'm trying

#^{:static true} [myFunc [ ^"[[Ljava.lang.String;" ] clojure.lang.IFn] 

in my declaration, and I'm getting back a

java.lang.RuntimeException: Unmatched delimiter: ]

runtime exception when I try to compile it.

Update 2 : Fixed by removing the ^ from the above line. (This is in the context of declaring function signatures in a gen-class so that ^ is presumably unnecessary.)

1

There are 1 answers

0
Marko Topolnik On BEST ANSWER

Multidimensional array types have no direct support in Clojure, but you can always fall back to using a String with the binary type name. In your case, this would look like the following:

[myFunc ["[[Ljava.lang.String;"] ReturnType]