Never mind, I see you tried that in your original code. ;) On Mon, Aug 7, 2017 at 1:03 PM, Gregg Reynolds <d...@mobileink.com> wrote:
> > > On Mon, Aug 7, 2017 at 10:56 AM, Sir Robert Burbridge <sirrob...@gmail.com > > wrote: > >> Didier, thanks for the reply! >> >> >> 1. I created a wrapper function like this: (defn -score [data >> context] (score data context)) >> 2. I tried your suggestion but got an error. Here's the current >> state: >> >> The JS calling code: >> >> function genFixture () { >> return new Array(12).fill(parseFloat(Math.random().toFixed(2))); >> } >> >> console.log("Generating fixtures..."); >> var data = genFixture(); >> var contex = new Array(10).fill(1); >> context.forEach((d,i) => { context[i] = genFixture(); }); >> >> // This produces, for example, the following fixtures: >> // data: [ 0.89, 0.89, 0.89, 0.89, 0.89, 0.89, 0.89, 0.89, 0.89, 0.89, >> 0.89, 0.89 ] >> // context: [ >> // [ 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, >> 0.35 ], >> // [ 0.85, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85, >> 0.85 ], >> // ... >> // [ 0.31, 0.31, 0.31, 0.31, 0.31, 0.31, 0.31, 0.31, 0.31, 0.31, 0.31, >> 0.31 ]] >> >> const java = require('java'); >> java.classpath.push("./java/alto.score-0.2.0-standalone.jar"); >> console.log("Importing class ..."); >> var score = java.import('alto.score'); >> >> console.log("Attempting to run score.scoreSync(data, context)"); >> try { >> var s = score.scoreSync(data, context); >> } catch (e) { >> console.log("Got an error:", e); >> } >> >> >> The resulting output looks like this: >> >> Generating fixtures... >> Importing class ... >> Attempting to run score.scoreSync(data, context) >> Got an error: Error: Could not find method "score([Ljava.lang.Double;, >> [Ljava.lang.Object;)" on class "class alto.score". Possible >> >> > You're trying to pass arrays. What happens if you try > > :methods [#^{:static true} [score [[Ljava.lang.Double [Ljava.lang.Object] > java.util.List]] > > Dunno if gen-class will accept that syntax, though. > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.