# Why does FromDigits transpose its argument (sometimes)?

a = {{1, 2}, {3, 4}, {5, 6}} ;

FromDigits /@ Transpose@ a == FromDigits @ a
(* True *)


The only "strange" syntax I've found in the docs is

But it doesn't seem related to this behavior. Or at least I don't see how.

Note that when there are only two lists, the second one is considered as base 10 "exponents" and threaded upon.

FromDigits @ {{1, 2}, {3, 4}}
(* {120, 1200} *)


that comes from the syntax above

FromDigits @ {{1, 2}, 3}
(* 120 *)

• (1) There is an ambiguous case (two lists of equal length) that gets resolved in a certain way. Else the input such as {{1,2},{3,4},{5,6}} becomes 100*{1,2}+10*{3,4}+1*{5,6}, that is, each sublist is treated as a "digit". Sep 18, 2015 at 14:34
• (2) This being "Malicious Friday", I may have to vote to close. Otherwise I'll have to play a prank on some hapless colleague. Sep 18, 2015 at 14:35
• Failing to mention threading over n seems a serious omission in the docs. (Maybe the writers noticed the ambiguity and left it out hoping no one would notice..) Sep 18, 2015 at 15:12
• There are a number of functions that "auto-thread" without mention in the documentation. I don't know if the reason for that has to do with possibilities of ambiguity. But I should mention that this particular case is not actually one of auto-threading. It is simply treating a case where digits themselves are lists. That this cannot be done when given two lists of the same length is a (perhaps unfortunate) consequence of the design. Sep 18, 2015 at 15:33
• Ah. Good motivating example. (Though the "real" way to do that digits problem is with integer or constraint programming). Sep 18, 2015 at 16:46