Re: :gen-class method signature help

2017-08-07 Thread Sir Robert Burbridge
Success! I've included the final solution here for completeness and community contribution. 1. Thanks, Didier-- your last bit got me on the right path. 2. Thanks, Gregg-- it turns out gen-class does recognize that syntax, if quoted, like so: #^{:static true} [score ["[Ljava.l

Re: :gen-class method signature help

2017-08-07 Thread Didier
Arrays in Clojure are different to Lists, and its probably why when you pass arrays to the score fn, that things don't work 100%. If you can coerce those arrays to a java list it would probably work. You can do that in js, but if that doesn't work or seem easy, you could have your -score wrappe

Re: :gen-class method signature help

2017-08-07 Thread Gregg Reynolds
Never mind, I see you tried that in your original code. ;) On Mon, Aug 7, 2017 at 1:03 PM, Gregg Reynolds wrote: > > > On Mon, Aug 7, 2017 at 10:56 AM, Sir Robert Burbridge > wrote: > >> Didier, thanks for the reply! >> >> >>1. I created a wrapper function like this: (defn -score [data >>

Re: :gen-class method signature help

2017-08-07 Thread Gregg Reynolds
On Mon, Aug 7, 2017 at 10:56 AM, Sir Robert Burbridge 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

Re: :gen-class method signature help

2017-08-07 Thread Sir Robert Burbridge
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

:gen-class method signature help

2017-08-06 Thread Didier
Also, you need to change the name of the "score" function in clojure to "-score". Yes, that's a dash prefixed to it. Unless you have configured gen-class to do differently using ":prefix". -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to t

:gen-class method signature help

2017-08-06 Thread Didier
Can you try: :methods [#^{:static true} [score [java.util.List java.util.List] java.util.List]] This says your score function takes two List arguments and returns a list. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send e

:gen-class method signature help

2017-08-05 Thread Sir Robert Burbridge
Hi all, I've got a very small Clojure task I need to get done. If needed, I am willing to pay someone for it. I expect would be less than an hour's work, but am not stuck on that =) *Simple Summary* I have a small, proprietary clojure library I am trying to embed in NodeJS via the node-java