A few of my macros currently require the user to pass the length of an array along with the array itself. It would be nice if the length could be calculated for them, as the user in question (myself) seems incapable of consistently counting beyond 3.
I've checked the pgfmanual's chapters 56 (for loops, where most of this is getting used) and 63 (mathematical functions where arrays are defined). In some sense, this is just counting commas (which I don't know how to do), but PGF has a few exceptions in arrays with () and {} allowing entries to have commas within them.
Can someone write a reasonable pgf math function that takes an array as its only argument and returns the length of that array as its result?

10used as in the provided examples. It will not return1as an answer, but it will count the elements of that number and return2as an answer. Some examples:The dimension of {10} is 2.,The dimension of {"10"} is 2.andThe dimension of {{10}} is 1.– karu Aug 01 '14 at 15:21pgfmathparser itself. The internal form of the array{1,2,3}is{{1}{2}{3}}while for the array{1}it is{1}(and IMHO should be{{1}}). But I need some time to dig into it. – cjorssen Aug 02 '14 at 14:19