The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

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]];
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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.