Just bc it's dynamically typed doesn't mean you can't leverage types for 
dispatch. Remember, you can single dispatch on type (using protocols), or 
multi-dispatch using a function applied to the arguments (multimethods). 

---
Joseph Smith
j...@uwcreations.com
@solussd


> On Oct 8, 2013, at 7:46 AM, "John D. Hume" <duelin.mark...@gmail.com> wrote:
> 
> 
> On Oct 8, 2013 5:35 AM, "Phillip Lord" 
> >
> > > However… I find that I am writing a lot of statements like this:
> > >
> > > (cond (hash-map? v)
> > >             ……
> > >
> > >            (vector? v)
> > >             ……
> > >
> > >            (list? v)
> > >            …..
> > >
> > >             :else …..)
> > >
> 
> zcaudate, in what context(s) do you find yourself writing a lot of 
> expressions like that? I rarely want to allow so much flexibility in 
> arguments. I'm wondering if there are idioms to avoid it.
> 
> > > I'm not sure a type checker will help in that instance.
> >
> >
> > A type-checker wouldn't no, but a type system would; pretty much
> > every language with a static type system has a type based dispatch
> > somewhere. It would be nice to be able to do
> >
> > (defun fn
> >   ([^vector v] ...)
> >   ([^list l] ...)
> >   ([else] ...)
> 
> How is Clojure's protocols feature different from what you're describing?
> -- 
> -- 
> 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to