Hi!
I have an error in my console that points to my function :
(defn sales-by-customer [name-cus]
(->> sales_2
(filter #(= (second %) name-cus))
(map #(* (Integer/parseInt (last %)) (Double. (products_2 (second %)))))
(reduce +)
)
)
sales_2 : [id customers_name products_name quantity]
([1 Sara candies 3]
[2 Joe jam 3]
[3 Sara gum 1])
products_2 : {products_name price}
({candies 6.0} {gum 4.5} {jam 45.1})
Basically, what I'm trying to do is, when I call (sales-by-customer "Sara"), I want to get the sum of Sara's purchases, which is in this case : (36.0 + 14.5) and display the result.
When I call my function, I get the following error message :
Syntax error (ClassCastException) compiling at (db.clj:76:1).
class clojure.lang.LazySeq cannot be cast to class clojure.lang.IFn (clojure.lang.LazySeq and clojure.lang.IFn are in unnamed module of loader 'app')
Any idea how to solve this error?
I'm supposed to get a number.. I don't know where the cast error occurs...
Thanks!