>It sounds to me as if the problem is with negative numbers.
>So, one more time ...  What about the *natural* numbers?
>Doesn't anyone else program with these?  (Maybe just occasionally? :-)

The problem is only partly to do with naturals. Having these would
certainly improve matters but I suspect the Num class is big enough
already. However, some other problems of (n+k) patterns are
 * syntax: + is the only nonconstructor constant allowed in patterns.
 * generality: mathematics commonly uses (bn+k) patterns, but Haskell doesn't
   allow this. It has one series of special cases only.
 * construction: laws were thrown out of Miranda because of the confusion
   created when something built one way, was taken apart another way. All our
   patterns *except (n+k)* have the property that the deconstruction reverses
   construction. If I build (a:as) then take it apart with pattern (x:xs) then
   x is a, and xs is as. If I build (a+b) then take it apart with pattern
   (n+1) then I cannot deduce that n is a (nor that 1 is b).

John.


Reply via email to