Im getting the dreaded * cannot be cast to IFn error with a simple mathematical function here:
(defn calc [sc1 m1 alpha beta gamma ta1 tb1 min_m1 min_tca tca_ratio x32]
(*
(max(0,
(+
(* alpha log(sc1))
(* beta log(m1))
(* gamma (/ ta1 tb1))
(- log(ta1) log(tb1)))))
(max(x32,(/ m1 min_m1)))
(max(x32,(/ tca_ratio min_tca)))))
;;;;;;;;;;;;
The args are simply a bunch of numbers :
(calc 1 2 3 4 5 1 2 3 4 5 1)
My thoughts / My Question
Usually, when I get this error, I find it is due to
1) An extra parenthesis (i.e. when I've accidentally put an extra closure in my code) OR
2) Arguments that are misordered (obviously - a cast exception) .
My question is simply... how to fix this snippet, and optionally -- how can I defeat this common exception once and for all ? It seems that it occurs quite often in my Clojure coding expeditions, and I'm thinking maybe I still haven't got the right development style yet.
-------------------------------------------------------
UPDATE :
I've riddled my code with unregular syntax. The errors were in the internal functions, which used an java/c style function calls : for example max / log ...