Does tuple_size count the elements in the tuple like lists:length()?
erlang
Solution
A tuple is one fixed size block compared to a list which is a linked list of list cells each of which has a head and a tail. So a tuple explicitly contains its size and `tuple_size(Tuple)` just directly returns this value.
Problem
Is there ever a reason where I would do something like: ``` {foobar, NumberOfElementsInFoobarTuple, ...} ``` I would imagine the internal datastructure for tuple_size knows it's size already, like the binary type. With binaries it's still beneficial to keep track of byte size as a variable instead of calling byte_size(). It doesn't make sense but that's how it is. I'm creating this tuple through list_to_tuple so it may have varying size.