[Haskell-cafe] Re: [Haskell-beginners] map question
ok at cs.otago.ac.nz
Tue Oct 20 19:44:18 EDT 2009
It's worth remembering that APL and SML, amongst others,
distinguish between the sign used for a negative literal
(¯1 in APL, ~1 in SML) and the sign used for subtraction
(the hyphen/minus in both of them). It doesn't seem to
be a hard thing to get your head around in practice.
From having worked on a Prolog system, I can tell you
that the fact that -1 is a single token except when it
isn't, yet -X is always two, caused headaches for implementors
and confusion for users.
In Smalltalk, -1 is a number, but x-1 is three tokens, not
two. (You have to keep track of what the previous token
was to tell what to do.)
If I were making suggestions for Haskell' (other than
please, pretty please with knobs on, let me keep n+k),
one of them would be to introduce the character U+00AF
(chosen because it's 8859-1, -4, -8, -9, and -15 at
least) as a unary minus sign, allowing it to be used
for exponent signs as well, so that
¯x - ¯1.0e¯10
Then Haskell'' could remove the unary - .
In the mean time, the unary - / binary - issue is something
you run into hard ONCE, and then avoid easily enough, not
unlike forgetting the back-ticks in x `div` y.
More information about the Haskell-Cafe