3 ms·
"I'll usually take a collection of "xs" and iterate over each "x" without any pretense that I'm coming back to make it better." Those can be perfectly fine nam
by jimbokun 8y ago
"I'll usually take a collection of "xs" and iterate over each "x" without any pretense that I'm coming back to make it better."
Those can be perfectly fine names!
xs indicates you are writing a generic method or function applicable to just about any kind of collection, and x is an item in xs. So for functions like map and reduce or anything else that deals with arbitrary collections, these names are very clear in expressing the intent and far better than @1, etc.
This is similar to using "i" as the index variable in a for loop, an almost universally recognized convention.