On 2010 Apr 28, at 6:06 PM, Meikel Brandmeyer wrote:
Ah, ok. I misunderstood what you were saying. But I think it doesn't
change the argumentation. If seq-contains? was fast on maps and sets,
people would abandon contains? because seq-contains? is "always
right":
works on seqs, fast on maps and sets. And again we are in the
situation,
that the developer does not make his intentions explicit.
What is the intention to be made exlicit here? That some sequences are
better than others? (car/cdr/list from old-school lisps were exactly
this kind of thinking, whether deliberate or not.)
How is it a developer is supposed to say: "only use a set or map" here?
I'm new enough to Clojure that I'm not clear on how duck-type-y the
idioms are.
Should I use assert to make my intention clear?
raise an exception?
just call some function that cares and expect that it will either
assert or raise for me?
Isn't this just the kind of thing that protocols are for? Again, I
think Stuarts video example with reduce is quite apropos. For certain
things, we can make some operations faster, and we can do it, post-
facto, wihin clojure itself.
-Doug
--
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