> I just want to get this out of my system, but I'm getting some class cast > exception and no useful line number.
In situations like these I find that looking at the entire stack trace provides clues. The REPL by default does not print the entire stack though I'm sure there is a way to achieve that. However I prefer to put the code in the file and run it as a script, which by default prints the entire stack and from that you can see what line it occured on (search for the first appearance of your filename). Doing so showed me that the exception was actually thrown in listmerge, because listmerge was passed in two integers instead of two lists, so I looked at where you called listmerge, and saw that you called concat probabbly expecting it to concat lists, but actually it concats the contents of the lists > (var-set my-list (concat @my-list (listmerge [...@l1] [...@l2])))) > @my-list)) Here is a naive solution: (var-set my-list (concat @my-list (list (listmerge @l1 @l2))))) @my-list) So in total your code minimally changed is: (defn msort [toSort] (with-local-vars [my-list (for [x toSort] [x]) l1 0 l2 0] (while (rest @my-list) ; (println @my-list) (var-set l1 (first @my-list)) (var-set l2 (second @my-list)) (var-set my-list (drop 2 @my-list)) (var-set my-list (concat @my-list (list (listmerge @l1 @l2))))) @my-list)) user=> (msort [64 45 2 67 1 7]) ((1 2 7 45 64 67)) NB: the good old print out my-list also helps narrow down what is happening. Again, I'm just providing a fix for your code, not suggesting this is the best approach. Regards, Tim. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---