Could you provide the stack trace of the exception?

I don't see any obvious problems, but the error may be caused by data
you pass into the function. Alternatively perhaps the error is not
caused inside let, but whatever consumes the results.

Maybe also providing a sample of the raw data would be useful.

Also, just as a point of style, function names and keywords in Clojure
are usually all lowercase, separated by dashes. e.g.
diff-common-orders, :receiving-order-id.

- James

On 27 April 2010 05:14, borgees <borg...@gmail.com> wrote:
> I'm a clojure newbie, trying to automate a script at work and running
> into an issue.
>
> Given a function
>
> (defn diffCommonOrders
>  "For each order, checks the two execs maps
>  for the entries and reports the differences"
>  [orders1 orders2 execs1 execs2]
>  (for [order (vals orders1) :when (not-empty (get execs1
> (order :receiving_order_id )))]
>     (let [order2 (orders2 (order :cl_ord_id))
>           recOrdId1 (get order :receiving_order_id)
>           recOrdId2 (get order2 :receiving_order_id)]
>      (difference (set (get execs1 recFirmOrdId1)) (set (get execs2
> recFirmOrdId2))))))
>
> with orders1 and orders2 defined as a map of String to Map with keys
> {:receiving_order_id :cl_ord_id ....}
> and execs1 and execs2 defined as maps of String to Vector, when I try
> to execute this function in the REPL, I get:
>
> java.lang.ClassCastException: clojure.lang.PersistentHashSet cannot be
> cast to java.util.Map$Entry
>
> I believe the error is occurring on the last line.  Why is it
> expecting a Map Entry?  Why can I not return whatever I want from the
> let?
>
> --
> 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 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