[Haskell-cafe] Re: map (-2) [1..5]

Jón Fairbairn jon.fairbairn at cl.cam.ac.uk
Thu Aug 17 11:56:43 EDT 2006

Stefan Monnier <monnier at iro.umontreal.ca> writes:

> > I'd have thought it would have been simpler to just make the rule that -2 
> > (no spaces between '-' and '2') would be a single lexeme,
> But then x-2 won't mean "subtract 2 from x" but "call x with arg -2".

Well, since the normal typographical convention is that
"hyphenated-words" are read as closely connected, I've
always been in favour of including hyphen in variable names
and using spaces to separate them from tokens, so perhaps it
should just mean "the identifier 'x-2'".

Though in the days of Unicode we could get round the whole
thing by using code 0x002d for unary minus, 0x2010 in
identifiers and 0x2212 for infix minus... and spend many a
happy hour trying to tell which of the three was intended by
some short horizontal line.

Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html  (updated 2006-07-14)

More information about the Haskell-Cafe mailing list