Hey :)

I have a little problem defining a multimethod with an array type as
parameter. I have something like this:

(defmulti amethod (fn [& args] (vec (map class args))))

(defmethod amethod [[C]
  ([par1] (String. par1)))

I want to pass a char-array as parameter. The internal java name i
"[C", but this doesn't work. I also tried "char[]", but the "[]" seem
to be problematic. If I define it this way it works:

(def *char-array-type* (class (make-array Character/TYPE 0)))

(defmulti amethod (fn [& args] (vec (map class args))))

(defmethod amethod [*char-array-type*]
  ([par1] (String. par1)))

Is there a way to define it without the global constant *char-array-
type*?

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