3 ms·
Edit: I'm trying to merge in all the ones other people have added; most are original still though. I don't Haskell, thankfully, but a lot of these are applicab
by o11c 2y ago
Edit: I'm trying to merge in all the ones other people have added; most are original still though.
I don't Haskell, thankfully, but a lot of these are applicable broadly. Some notes/additions I've seen in other languages (but far more often these are obvious).
(only vaguely sorted, since many aren't contiguous):
a can mean "argument" particularly; also "arg"
a,b,c,d can be anything, but slightly more common for floats and/or coefficients, or matrices
a is often "array"
a can be ascii (either as string in general, or in specific)
a can be "allocator" or "allocation"
b for bytes is not shameful, but sometimes it means "buffer", "blob", or "bits" instead. Can be used for just an element or for a sequence of them.
b can be "builder" (a utility class used to construct values instead of using "new" directly)
b can be "base"
b,e for begin/end (often for iterators/indices)
c is often used for "character", "code unit", "codepoint"; ch/cu/cp can disambiguate
c can also be "constant" (either a value or a modified type)
c can also be "container"
c can also be "condition" (a boolean)
c can also be "context", but more often ctx or ctxt
d is rarely used for "data", but more often it's expanded or v is used instead
d can be "direction", but more often dir
d,s can be destination/source
e can also be "event"; ev if needed
e can also be "element" (member of an array, member of an XML-like tree)
f is common for floats (even if called "double" or "real") or fixed-point numbers
f is often file; fp/fo may be common depending on the language
g for graph
h for handle
i can also be "instruction"
i,o,r,w can be input/output
i,j,k are common as indices *or* iterators, corresponding to x, y, z if meaningful.
l is rare but can be a 4th index or iterator if needed, usually does not related to w though.
l is probably more common as "length"/"limit"
l can be "long" in various senses
l,h can be low/high, but more often lo/hi
l,r can be left,right (also lhs,rhs), especially of a binary operator (or occasionally a unary one, e.g. to disambiguate prefix/suffix)
m = mode?
n,+m are often specifically the upper bound of a range, similar to l
n can be node (of a tree/graph)
o is an arbitrary object (usually, when explicitly not a primitive or string)
o can be "origin"
p,+q are not rare as "predicate"
p,q can also be prime numbers
p is for pointer
p = part?
p,q = percent chance (often normalized to 0-1 though)
q for queue
q for query/request
q for "quad"
q,r,n,d for fractions
r (and rv/res) is sometimes used ambiguously - should it be the return value of a function I called, or the value I'm planning to return? Can also stand for "reply".
r can be "range"
r can be "rectangle"
r can be "register"
r,c for row, column; origin is top-left and axes are flipped
r,g,b,a are color components; other letters exist for other colorspaces
s is often an arbitrary string
s can also be symbol (sy/sym depending on context), statement (stmt), or set (often given a different kind of name)
s can be "stack"
t for table
t for time
t,u,v (usually uppercase) are arbitrary types in generics
u,g,o for user/group/other
v is often just an arbitrary data value (not meaningfully numeric/string/object), even without a container
v,w,t,u can also mean "vector" specifically
w = word
u,v,s,t,q are used for 2D texturing
u can be unicode
w can be wide character, but good riddance
w is for window
x can also be "expression" in particular
x,o,d,b can be hex, octal, decimal, or binary bases
x,y,w,h are start/size of a rectangle
x,y,z,w are used for 3D objects; w is often normalized to 1
_ as a function or string affix means "call gettext on this now"; N_ means "remember to call it later"
_,$ are sometimes injected as a general-utility global variable in languages with deficient standard libraries
Mostly not mentioned, several of these are used uppercase for generic type arguments.
I'm also ignoring all the various units and physical constants.
I'm pretty sure about a dozen more passed through my head while writing this but I forgot them before I finished writing the previous entry, and I can't be bothered to actually start scanning code.
- archargelod 2y agob for boolean d for distance / date e for error / exception f,g are often used as generic function name g can be global value r for radius r is a random value t for tally t is any temporary value m for matrix
- o11c 2y agoHm, I probably should pull out the ones from the original article that I actually recognize (a couple of yours are from that). Mine was originally intended as a supplement, then it got out of control. I thought about `M` for matrix but after thinking I realized it's almost always `A` or something, with `m` as a dimension. That does remind me of `I` for identity though ... Ah, the editing window is closed, so I guess I have to extend it: f,g,h - function f - flags i - identity (e.g. of matrix) h,n/p,m - haystack, needle/pattern, match h,t - head, tail k,v - key, value of a map/dictionary l - location s - state t - token
- Supermancho 2y ago> _,$ are sometimes injected as a general-utility global variable in languages with deficient standard libraries I would say that underscore is used as convention. There are languages where the underscore is either tool supported or language reserved for this purpose broadly or in limited context (lambdas). Languages that use underscore for ignored values include Java, Erlang, Python, Scala, Clojure, F#, SML, Swift, et al.
- aloisdg 2y agoTrue in Elixir too