Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

Executing Trace on an expression reveals what is actually happening:

Trace[Remove@x; x = 1]
(*{Remove[Removed[x]];Removed[x]=1,{Remove[Removed[x]],Null},{Removed[x]=1,1},1}*)

"the Wolfram Language always reads in a complete input expression, and interprets the names in it, before it executes any part of the expression." (see: https://reference.wolfram.com/language/tutorial/SettingUpWolframLanguagePackages.html)

The whole line is one expression with the head CompoundExpression. The variable x gets replaced with Removed["x"] throughout that expression. Then it seems that Removed["x"] is assigned the value 1 (see Leonid Shifrin's answer to this questionquestion for more details about Removed symbols).

However, when you write it on two different lines, it is interpreted as two separate expressions and hence you don't face this problem.

Executing Trace on an expression reveals what is actually happening:

Trace[Remove@x; x = 1]
(*{Remove[Removed[x]];Removed[x]=1,{Remove[Removed[x]],Null},{Removed[x]=1,1},1}*)

"the Wolfram Language always reads in a complete input expression, and interprets the names in it, before it executes any part of the expression." (see: https://reference.wolfram.com/language/tutorial/SettingUpWolframLanguagePackages.html)

The whole line is one expression with the head CompoundExpression. The variable x gets replaced with Removed["x"] throughout that expression. Then it seems that Removed["x"] is assigned the value 1 (see Leonid Shifrin's answer to this question for more details about Removed symbols).

However, when you write it on two different lines, it is interpreted as two separate expressions and hence you don't face this problem.

Executing Trace on an expression reveals what is actually happening:

Trace[Remove@x; x = 1]
(*{Remove[Removed[x]];Removed[x]=1,{Remove[Removed[x]],Null},{Removed[x]=1,1},1}*)

"the Wolfram Language always reads in a complete input expression, and interprets the names in it, before it executes any part of the expression." (see: https://reference.wolfram.com/language/tutorial/SettingUpWolframLanguagePackages.html)

The whole line is one expression with the head CompoundExpression. The variable x gets replaced with Removed["x"] throughout that expression. Then it seems that Removed["x"] is assigned the value 1 (see Leonid Shifrin's answer to this question for more details about Removed symbols).

However, when you write it on two different lines, it is interpreted as two separate expressions and hence you don't face this problem.

Added link to related question
Source Link
dan7geo
  • 1.4k
  • 8
  • 14

Executing Trace on an expression reveals what is actually happening:

Trace[Remove@x; x = 1]
(*{Remove[Removed[x]];Removed[x]=1,{Remove[Removed[x]],Null},{Removed[x]=1,1},1}*)

"the Wolfram Language always reads in a complete input expression, and interprets the names in it, before it executes any part of the expression." (see: https://reference.wolfram.com/language/tutorial/SettingUpWolframLanguagePackages.html)

The whole line is one expression with the head CompoundExpression. The variable x gets replaced with Removed["x"] throughout that expression. Then it seems that Removed["x"] is assigned the value 1 (can someone clarify what is happening here?see Leonid Shifrin's answer to this question for more details about Removed symbols).

However, when you write it on two different lines, it is interpreted as two separate expressions and hence you don't face this problem.

Executing Trace on an expression reveals what is actually happening:

Trace[Remove@x; x = 1]
(*{Remove[Removed[x]];Removed[x]=1,{Remove[Removed[x]],Null},{Removed[x]=1,1},1}*)

"the Wolfram Language always reads in a complete input expression, and interprets the names in it, before it executes any part of the expression." (see: https://reference.wolfram.com/language/tutorial/SettingUpWolframLanguagePackages.html)

The whole line is one expression with the head CompoundExpression. The variable x gets replaced with Removed["x"] throughout that expression. Then it seems that Removed["x"] is assigned the value 1 (can someone clarify what is happening here?).

However, when you write it on two different lines, it is interpreted as two separate expressions and hence you don't face this problem.

Executing Trace on an expression reveals what is actually happening:

Trace[Remove@x; x = 1]
(*{Remove[Removed[x]];Removed[x]=1,{Remove[Removed[x]],Null},{Removed[x]=1,1},1}*)

"the Wolfram Language always reads in a complete input expression, and interprets the names in it, before it executes any part of the expression." (see: https://reference.wolfram.com/language/tutorial/SettingUpWolframLanguagePackages.html)

The whole line is one expression with the head CompoundExpression. The variable x gets replaced with Removed["x"] throughout that expression. Then it seems that Removed["x"] is assigned the value 1 (see Leonid Shifrin's answer to this question for more details about Removed symbols).

However, when you write it on two different lines, it is interpreted as two separate expressions and hence you don't face this problem.

Emphasized words
Source Link
dan7geo
  • 1.4k
  • 8
  • 14

Executing Trace on an expression reveals what is actually happening:

Trace[Remove@x; x = 1]
(*{Remove[Removed[x]];Removed[x]=1,{Remove[Removed[x]],Null},{Removed[x]=1,1},1}*)

"the Wolfram Language always reads in a completecomplete input expression, and interprets the names in it, beforebefore it executes any part of the expression." (see: https://reference.wolfram.com/language/tutorial/SettingUpWolframLanguagePackages.html)

The whole line is one expression with the head CompoundExpression. The variable x gets replaced with Removed["x"] throughout that expression. Then it seems that Removed["x"] is assigned the value 1 (can someone clarify what is happening here?).

However, when you write it on two different lines, it is interpreted as two separate expressions and hence you don't face this problem.

Executing Trace on an expression reveals what is actually happening:

Trace[Remove@x; x = 1]
(*{Remove[Removed[x]];Removed[x]=1,{Remove[Removed[x]],Null},{Removed[x]=1,1},1}*)

"the Wolfram Language always reads in a complete input expression, and interprets the names in it, before it executes any part of the expression." (see: https://reference.wolfram.com/language/tutorial/SettingUpWolframLanguagePackages.html)

The whole line is one expression with the head CompoundExpression. The variable x gets replaced with Removed["x"] throughout that expression. Then it seems that Removed["x"] is assigned the value 1 (can someone clarify what is happening here?).

However, when you write it on two different lines, it is interpreted as two separate expressions and hence you don't face this problem.

Executing Trace on an expression reveals what is actually happening:

Trace[Remove@x; x = 1]
(*{Remove[Removed[x]];Removed[x]=1,{Remove[Removed[x]],Null},{Removed[x]=1,1},1}*)

"the Wolfram Language always reads in a complete input expression, and interprets the names in it, before it executes any part of the expression." (see: https://reference.wolfram.com/language/tutorial/SettingUpWolframLanguagePackages.html)

The whole line is one expression with the head CompoundExpression. The variable x gets replaced with Removed["x"] throughout that expression. Then it seems that Removed["x"] is assigned the value 1 (can someone clarify what is happening here?).

However, when you write it on two different lines, it is interpreted as two separate expressions and hence you don't face this problem.

Corrected to Removed["x"]
Source Link
dan7geo
  • 1.4k
  • 8
  • 14
Loading
Fixed incorrect inline code marker
Source Link
dan7geo
  • 1.4k
  • 8
  • 14
Loading
added 60 characters in body
Source Link
dan7geo
  • 1.4k
  • 8
  • 14
Loading
Added code blocks
Source Link
dan7geo
  • 1.4k
  • 8
  • 14
Loading
deleted 4 characters in body
Source Link
dan7geo
  • 1.4k
  • 8
  • 14
Loading
Source Link
dan7geo
  • 1.4k
  • 8
  • 14
Loading