HaloO, Smylers wrote:
That depends on exactly what you mean by "we" and "need".
Well, with "we" I meant the Perl 6 language list and "need" is driven by the observation that we can't agree on a single definition, so picking your personal favorite should be possible.
By all means have them available as modules.
That is perfectly fine. We should have / return a Num, div return an Int and % as the Num modulus. This somewhat leaves mod undefined. How could we fill-in that gap with a useful case? Perhaps we sneak in euclidean remainder? But that would not fit the F-definition div. So we might have the pairs fdiv and % and div and mod in core and the rest in a module. Hmm, or we drop % or use it for something else. The simplest solution is to have mod as alias for %. Note that F-definition and E-definition agree for a divisor greater than zero. My list was sorted in decreasing order of importance with the F-definition beating the E-definition in popularity. So all I want is use Math::DivMod:euclid; to get the E-definition and a use Math::DivMod; to get them all. The F-definition beeing the default when no import is done. A sane definition of div and % is important. A spec that leaves it up to the implementation to pick whatever is convenient is bad in my eyes. Regards, TSa. --