25 Sep
2002
25 Sep
'02
10:07 a.m.
Dr Mark H Phillips wrote:
Hi,
Does Haskell specify how div and mod should behave when given one or both arguments negative?
Yes, section 6.4.2 gives an exact definition.
P.S. I notice in hugs if I type "-1 `div` 3" the `div` binds to the 1 and 3 first, and only applies the "-" at the end. Is there a reason why the unary "-" has weak binding?
The rational is that unary `-' has the same precedence as binary `-'. Personally, I think this is counter-intuitive to do it the way Haskell does. -- Lennart