Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13342

Re: Dynamic scoping

From "Rolf.Mertig@gmail.com" <Rolf.Mertig@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Dynamic scoping
Date 2013-02-03 07:49 +0000
Message-ID <kel4qe$38d$1@smc.vnet.net> (permalink)
References <keiatl$qq3$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Dynamic scoping Daniel Huber <danielphuber@gmail.com> - 2013-02-02 06:15 +0000
  Re: Dynamic scoping "Rolf.Mertig@gmail.com" <Rolf.Mertig@gmail.com> - 2013-02-03 07:49 +0000
    Re: Dynamic scoping Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-05 08:06 +0000
  Re: Dynamic scoping Daniel Huber <danielphuber@gmail.com> - 2013-02-06 06:50 +0000

csiph-web