Mads Lindstrøm wrote:
Andrew Coppin wrote:
Idiomatic Haskell seems to consist *only* of single-letter variable
names.
The more abstract (generic) thing gets, the less likely you will be able
to find a telling name. And if you cannot find a telling name, you can
just as well make it short. And as Haskell is more abstract, we get more
short identifiers. E.g. in your earlier sorting function:
qsort (x:xs) = ...
what would you propose to call the elements?
Well, qsort (element : list) would be maximally intuitive, but who's
going to implement it like that? ;-)
Now of course in C, you'd be forced to write something like
list qsort(int x, list xs)
which makes it completely unambiguous what these things are - what their
type is. But in Haskell, even if you add a type signature:
qsort:: (Ord x) => [x] -> [x]
Nobody is going to realise that "[x]" means a list. And it's still not
clear where ":" comes from, or... well you can see why people are
getting lost! ;-)
However, I will grant you that Map k v, could have used longer type
variables. But we are not alone with using one letter type variable
names http://java.sun.com/javase/6/docs/api/java/util/HashMap.html . And
frankly, in this specific case, I think most programmers (Haskell or
non-Haskell) will be able to guess what k and v means, when they are
standing right after Map.
Only if you can figure out that "Map" means what every other programming
language on the face of the Earth calls a "dictionary". (This took me a
while!)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe