12
$\begingroup$

When you write this code:

tab = {{1, 1}}; tab = Join[tab, {{2,2}}];

you expect to get the following table:

{{1, 1}, {2, 2}}

but, if you write the following code instead:

tab = {{1, 1}}; tab = Join[tab, {{2, 2}}]; ListPlot[tab]

and after that, you check the elements of tab, it will contain these elements:

{{1, 1}, {2, 2}, {2, 2}}

Why does it happen? Is it a kind of bug of Mathematica, or I do not understand how the Join function works? (I'm running version 10.0.0 on Windows 10.)

Here I post a screenshot

$\endgroup$
20
  • 1
    $\begingroup$ That's not what I get. You may need to clear tab. Clear[tab] $\endgroup$
    – Young
    Jul 23 '16 at 0:41
  • $\begingroup$ I am using Mathematica 10. If you place Clear on the same line, it works. But not if you do it in separate lines. I mean, what you say works if you write: Clear[tab]; tab = {{1, 1}}; tab = Join[tab, {{2, 2}}]; ListPlot[tab] $\endgroup$
    – Francisco
    Jul 23 '16 at 0:43
  • 4
    $\begingroup$ I can confirm this problem in Mathematica 10.0.0. The strangest thing I ever saw. $\endgroup$
    – C. E.
    Jul 23 '16 at 1:15
  • 3
    $\begingroup$ Do not use 10.0.0. Upgrade at least to 10.0.2, which should be a free upgrade to you. Upgrade to the latest version if you have access. $\endgroup$
    – Szabolcs
    Jul 23 '16 at 12:49
  • 7
    $\begingroup$ I would put money on the damn Suggestions Bar (Predictive Interface) being the culprit. Turn it off! @C.E. Can you confirm? $\endgroup$
    – Mr.Wizard
    Jul 23 '16 at 14:14
9
$\begingroup$

As Mr. Wizard wisely suggested in his comment, the Suggestion Bar feature is the source of this bug. I have confirmed that turning it off removes the bug.

The canonical answer for Suggestion Bar troubles is found here. It shows how to turn it off, under Preferences > Interface.

$\endgroup$
1
  • $\begingroup$ It solved the problem, thank you. $\endgroup$
    – Francisco
    Jul 24 '16 at 13:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.