Changes between Version 6 and Version 7 of NegativeSyntax


Ignore:
Timestamp:
Oct 16, 2007 9:02:16 PM (7 years ago)
Author:
igloo@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NegativeSyntax

    v6 v7  
    2727 
    2828  If we removed special treatment of '-', then these become symmetrical again.  However it seems unintuitive that {{{(-x)}}} is a right section of '-', but {{{(-1)}}} is the literal -1. 
     29 
     30---- 
     31 
     32Another motivation for lexing - as part of a numeric literal (or changing its precedence), from 2007-10-10 #haskell: 
     33{{{ 
     34[09:33] < quicksilver> am I the only person who finds mod's behaviour with 
     35                       negative numbers stupid 
     36[09:34] < matthew-_> try rem then 
     37[09:34] < quicksilver> > (-4) `mod` 16 
     38[09:34] < quicksilver> > (-4) `rem` 16 
     39[09:34] < lambdabot>  12 
     40[09:34] < lambdabot>  -4 
     41[09:34] < quicksilver> that's odd, that's not what my ghci did 
     42[09:34] < quicksilver> doh 
     43[09:34] < quicksilver> bracketing error :P 
     44[09:35] < quicksilver> mod does do what I expect, if I put the negative number 
     45                       in bracets 
     46[09:35] < quicksilver> I wouldn't expect 'unary minus' to have lower precedence 
     47                       that `mod` though 
     48[09:35] < sieni> > -4 `rem` 16 
     49[09:35] < lambdabot>  -4 
     50[09:35] < sieni> oops 
     51[09:35] < sieni> > -4 `mod` 16 
     52[09:35] < lambdabot>  -4 
     53[09:35] < quicksilver> sieni: yeah, that's what I did 
     54[09:36] < sieni> quicksilver: yeah I know, that has bitten me too :-) 
     55[09:36] < quicksilver> I always expect unary minus to bind tight 
     56[09:37] < osfameron> yeah, haskell's unary minus is surprisingly loose 
     57}}}