4 ms·
The Clojure world has a set single-letter naming conventions that, since they are widely accepted, greatly improve readability. If you see an argument named `f`
by jetrink 8y ago
The Clojure world has a set single-letter naming conventions that, since they are widely accepted, greatly improve readability. If you see an argument named `f`, you can be sure it is a function. `m` is a map, while `k` and `v` are used for keys and values, respectively. `x` and `y` are numbers and `n` is always an integer.
- FlipperBucket 8y agoI prefer a convention of semantically relevant variable names prefixed/suffixed by a letter indicating type.
- Sharlin 8y agoDidn't we already collectively decide that Hungarian notation is a bad idea? About 20 years ago?
- FlipperBucket 8y agoNo. It's alive and particularly pragmatic in dynamic languages. The type of sigil, @ or $ or I or Array(space) are all equal to the interpreter. The difference is how offended you might be that type annotations are semantically identical.
- jetrink 8y agoTo be clear, the above examples are used when the function is designed to accept any such argument and only relevant info is the type.
- nine_k 8y agoI bet the scope of such names is pretty narrow, no more than 3-4 lines? The narrower the scope, the less descriptive your names may be, and such math-like conventions make sense. In a 50-line function (which you should avoid but sometimes can't because of long lines wrapped for readability), using a name like `f` throughout is a harder sell.