How about

(def float-2D (class (make-array Float/TYPE 1 1)))?


sincerely,

--Robert McIntyre



On Fri, Jan 14, 2011 at 4:07 AM, Ken Wesson <kwess...@gmail.com> wrote:
> On Fri, Jan 14, 2011 at 3:53 AM, Sunil S Nandihalli
> <sunil.nandiha...@gmail.com> wrote:
>> Hello Everybody,
>>  I would like to know how to have one of the multimethods dispatch on [[F
>>  (2d-array of float) .. I don't know how to say that in the code .. I can
>> say  Integer Double etc.. How do I say 2-d-array of floats? what is the
>> literal representation of [[F... I am not sure if I am clear with my
>> question .. I remember somebody had before used something like this .. but I
>> am unable to find it right now...
>
> I don't think there is a literal representation, but you also don't
> need it to be literal:
>
> user=> (defmulti foo #(vector (type %1) (type %2)))
> #'user/foo
> user=> (defmethod foo [(type (make-array (type (float-array 0)) 0))
> String] [x y] (println "[[F and String"))
> #<MultiFn clojure.lang.MultiFn@1a65cf7>
> user=> (foo (make-array (type (float-array 0)) 0) "foo")
> [[F and String
> nil
>
> There may still be a somewhat more elegant way of getting the type; I
> just promise that this way works. :)
>
> --
> 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