Short short version: elem/2 exists because typing :erlang.element is too many characters.
Record also provides some examples of places where elem (or it’s Erlang equivalent) are useful, for instance is_record?:
My interpretation of the release notes about setelement optimizations is that sequences like this one (also from Record) may get a boost from the compiler and/or JIT:
Since the intermediate tuples don’t escape the function, the reduce could do all the mutation in-place.






















