Using single letters in a piece of code helps in outlining the structure, instead of the contents.
That is why mathematical formulas are written with x, y, and z instead of long names. The idea is that we are emphasizing the generic relations, not what might be fed to the function.
Similarly, when writing functional code it is good style to use single letters instead of long names.
Absolutely. These conventions are not arbitrary and the people working within them are not stupid. That they would lead to poor code in a completely different language is beside the point.
I went through something like this hacking in Lisp, actually. When I started out, I used long descriptive variable names; it's the CL style anyway (MULTIPLE-VALUE-BIND, anyone?) Over time, I found myself using shorter and shorter names, to the point where my code is now of the sort that some of the commenters here would apparently fire me for it. Yet it's not like I somehow became less passionate about readable, clear code. What gives?
It took me a while to figure out. As programs get shorter (because the level of abstraction gets higher), the shape of the code itself becomes increasingly meaningful. (I mean the physical shape of the code as it appears on the screen.) This is doubly true of languages with very regular syntax like Lisp and K, and is a huge advantage to such regularity. Partly this is just that, since the program is shorter, more of it fits on one screen. But I think it's a deeper and more mysterious effect than that. You begin to develop an intuition for different patterns that have different semantics, as it were. Grokking these patterns becomes a big part of what you do when you read this sort of code. This effect is weaker in mainstream languages, so it's not surprising that people aren't aware of it. (Edit: although I used to joke that I could tell how good C# code was by printing out reams of it, hanging it on a wall, and stepping back 15 feet. That's an example of the effect too. It's just that in more powerful languages you don't have to step back 15 feet to see it.)
When you're working in a verbose language, long variable names are indispensable. You've got a whole lot of lines of code to read through, and a name like "x" does nothing to orient you as you switch contexts. But exactly the opposite is true of dense, concise programs. Variable names as long as even, say, "customerID" will dominate such programs textually, obscuring their natural shape. To increase overall clarity, you have to shorten those names to a length consonant with their semantic role. In other words, this style evolved not because people don't care about readability but because they are trying to maximize it.
A convention like "one letter for local vars, two for global, and three for functions" is exactly the sort of thing that would help achieve this in a language like K.
Ironically, I have given a verbose expansion of what you just said:
Using single letters in a piece of code helps in outlining the structure, instead of the contents.[...] The idea is that we are emphasizing the generic relations
My excuse is exploratory writing: I've been meaning to write about this for a while to clarify how it works in my head. And I don't have time to make it shorter :)
Yes, and if you spend some time working with J, you will find that they solve this by avoiding variables altogether. Functions in J can only be applied to one or two variables, and it is clear from the context what the number is. So, you can write a bunch of code without referring to the arguments.
That is why mathematical formulas are written with x, y, and z instead of long names. The idea is that we are emphasizing the generic relations, not what might be fed to the function.
Similarly, when writing functional code it is good style to use single letters instead of long names.