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

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

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

doc-item

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 *)
$\endgroup$
  • 2
    $\begingroup$ (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". $\endgroup$ – Daniel Lichtblau Sep 18 '15 at 14:34
  • 3
    $\begingroup$ (2) This being "Malicious Friday", I may have to vote to close. Otherwise I'll have to play a prank on some hapless colleague. $\endgroup$ – Daniel Lichtblau Sep 18 '15 at 14:35
  • $\begingroup$ 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..) $\endgroup$ – george2079 Sep 18 '15 at 15:12
  • 1
    $\begingroup$ 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. $\endgroup$ – Daniel Lichtblau Sep 18 '15 at 15:33
  • 1
    $\begingroup$ Ah. Good motivating example. (Though the "real" way to do that digits problem is with integer or constraint programming). $\endgroup$ – Daniel Lichtblau Sep 18 '15 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.