MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Dynamic scoping


Am Samstag, 2. Februar 2013 07:15:17 UTC+1 schrieb Daniel Huber:
> Block is supposed to be a dynamic scoping construct. Therefore, in the following, "Print" should be an undefined function. But consider:
> 
> 
> 
> Block[{Plus},
> 
>  t = ToString[Plus[1, 2]];
> 
>  Print[t];
> 
>  ]
> 
> 
> 
> The output of this is: "3" and not "Plus[1,2]" as it would be if "Print" has no defined meaning.
> 
> cheers, Daniel

Block[{Plus = "Plus"}, t = ToString[Plus[1, 2]];
 Print[t];]
will do what you want



  • Prev by Date: Re: Labelling each curve and changing grid in ParametricPlot
  • Next by Date: Re: Labelling each curve and changing grid in ParametricPlot
  • Previous by thread: Dynamic scoping
  • Next by thread: Re: Dynamic scoping