Hello all...

I've been stuck for a good 2 hours trying to figure out why I'm getting this exception on a very simple example:

ClassCastException clojure.lang.ArraySeq cannot be cast to [D clojure.lang.Numbers.doubles (Numbers.java:1280)

I have 2 very simple functions:
---------------------------------------------------------------------------------------------------
(defn normalize
[data high-end low-end]
(let [norm (NormalizeArray.)]
(do (. norm setNormalizedHigh high-end)
      (. norm setNormalizedLow  low-end)
      (. norm process data))))  ;;returns array of doubles


(fn [window-size prediction-size]
 (let [twa (TemporalWindowArray. window-size prediction-size)]
 (do (. twa analyze (normalize data)) ;;analyze expects array of doubles
       (. twa process (normalize data))))) ;;same here
---------------------------------------------------------------------------------------------------

Now, I know for a fact that 'normalize' will return the last statement in the 'do' block which is the call to the process method which in turn will produce a double array. In theory all is well cos analyze and process also expect double arrays for arguments. However, I am getting the above exception even though the types are correctly passed in! I used (class (normalize data 0.9 0.1)) and I do get back an array of doubles!!!

What exactly is happening? Any Java interop gurus out there?

Thanks in advance...


Jim

--
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

Reply via email to