On Fri, Dec 5, 2008 at 9:10 AM, David Green <[EMAIL PROTECTED]> wrote: > I misremembered div vs. idiv, but how standard is it? I know "div" commonly > means int division, but not always.
True enough. In ANSI C, / already does integer division, but there's also a div() function - the difference there is that div() is guaranteed to round toward zero, whereas the rounding semantics of / is implementation-dependent. > On the one hand, some things you just have to learn; on the other, lots of P6 > operators have > word-names as well as symbols, and "div" is the obvious way to spell "/" > (what else would you > call it?). Well, respelling it is OK, just not sure how. Python 3 uses // for integer division, but we don't want to open up that can of worms again.. >> A way to get both [quotient and reminder] in one fell swoop would be nice > > Would it make sense to include the remainder as a trait on the quotient? Maybe, but it smacks of the old and smelly "0 but true" type hacks to me. > Or return some other special compound type that numifies to the quotient. There could be a special-purpose Quotient type with the desired behavior, but maybe Perl6 would benefit from a generic "stealth list" type, like Lisp's multiple values. Such an object behaves like a simple scalar, even in list context, but if you use the right methods you can access additional values beyond the obvious one. -- Mark J. Reed <[EMAIL PROTECTED]>