From: Albert G. <Dr....@t-...> - 2008-07-09 05:03:37
|
Libor Spacek wrote: > The idea is that all the current numeric types become transparent (hidden) to the user. As Eddie already pointed out, that's the idea behind Scheme's numeric tower; that's probably as far as you can go to alleviate the complexities of the numeric tower before hitting the wall of computational complexity. I've already explained in another thread why Pure doesn't follow Scheme's scheme in order to achieve its goals, so I won't rehash this discussion here. In any case Pure makes it easy to write polymorphic functions which work with all numeric types without a big runtime penalty, and also makes it easy to distinguish them when it's necessary. There are a few inconveniences where you have to use explicit conversions to tell the interpreter which kind of result you actually want, but I think that they're relatively minor. YMMV. But at least Pure allows you to add your own equations to existing operations to patch them up the way you want them, like you did with the mod operation. > The beauty of this scheme is that you could then get away with having just ::number type and nothing else and use only one common code for any calculations, instead of the current, frankly, mess. Yeah, one can dream. But there's always the tradeoff between speed and convenience, that's why we still need machine ints and floating point numbers. "If you can't make it both fast and correct, make it fast." ;-) Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |