On Mon, Dec 20, 2010 at 10:54 PM, Stephen Pardue
<pardue.step...@gmail.com>wrote:

> (defn panda-2 [x]
>    (let [xType (type x)]
>        (cond
>            (= java.lang.String xType) "HELLZ YEAH IT'S A STRING!"
>            (= java.lang.Integer xType) "it's an integer...")))
>

You should take a look at condp.

If you find yourself dispatching on type a lot and performance is of the
essence then you should take a look at deftype/record and protocols.

If generality is more important (dispatching on more than the first
argument), multimethods are great.

David

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