On Thu, Feb 26, 2009 at 1:18 PM, Phil Hagelberg <p...@hagelb.org> wrote:

>
> Peter Wolf <opus...@gmail.com> writes:
>
> > Is there a good reason that + can't do the right thing as with other
> > Java and scripting languages?  I think this would be popular with
> > non-LISPers.
>
> Putting a type check in + would slow down basic math, and there is a
> class of user who will complain loudly if basic math slows
> down. However, this also means that > and < also don't work on strings,
> which is pretty lousy.
>
> One approach that's been proposed in #clojure is to make these functions
> more capable by default, but then provide a fast-math library that could
> redefine them in terms of numerics-only. I'm a big fan of functions
> doing the most helpful thing by default but being able to offer better
> speed when you need it.
>
> Convenience vs speed is always a trade-off, but I think convenience
> should win in the default case. What do others think about this?
>

I would much rather have a fast-math library that redefined common operators
for numeric types only, and had the default +, <, > be multimethods.

-- 
Cosmin Stejerean
http://offbytwo.com

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