Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Dynamic scoping
Replies: 3   Last Post: Feb 6, 2013 1:50 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Rolf.Mertig@gmail.com

Posts: 38
Registered: 11/23/05
Re: Dynamic scoping
Posted: Feb 3, 2013 2:49 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.