hi,

i'm up to date with the clojure jar. the error messages i get seem
awfully terse and not particularly helpful in learning what i'm doing
wrong. for example, with the code below, when i try (bs 0 (vector 1 2
3)) i get "java.lang.ClassCastException:
clojure.lang.LazilyPersistentVector (NO_SOURCE_FILE:0)". swapping the
order of args in the 2nd 'nth' call fixes it.  is there no way to get
Clojure to help me out a little with such things?

thanks for any clues :)

(defmulti bs (fn [find data] (count data)))
(defmethod bs 0 [find data] -1)
(defmethod bs 1 [find data]
  (if
      (= (nth data 0) find)
    0
    -1))
(defmethod bs :default [find data]
  (let [lo 0
        hi (count data)
        mid (/ (+ lo hi) 2)
        testv (nth mid data)]
    -42))

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

Reply via email to