MathGroup Archive 2008

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

Search the Archive

Re: Dynamic (more)



Hi Luca,

Dynamic does only evaluate its arguments for display. Convince yourself by:

Dynamic[Print["asas"];1]  this gives a message

Dynamic[Print["asas"];1]; this gives no message

therefore, the statement:q = p + 1 in  Dynamic[q = p + 1]; is never 

executed.

Further, q=1;Dynamic[q] does return Dynamic[q] and not 1. Try: 

q=1;Dynamic[q]//FullForm This is then further evaluated for display to 

give 1.

hope this helps, Daniel



Gianluca Gorni wrote:

> Hi!

> 

> The following gives the (expected?) result 1:

> 

> p = 0;

> q = 0;

> Dynamic[q = p + 1];

> Dynamic[q]

> 

> This one gives {1, 1}, also as I would expect:

> 

> DynamicModule[{p, q},

>   p = 0;

>   q = 0;

>   {Dynamic[q = p + 1],

>    Dynamic[q]}]

> 

> 

> Can anybody explain why the next gives 0?

> 

> DynamicModule[{p, q},

>   p = 0;

>   q = 0;

>   Dynamic[q = p + 1];

>   Dynamic[q]

> ]

> 

> 

> Try the following pair too:

> 

> DynamicModule[{p = 0, q}, {Dynamic[q = p + 1], Dynamic[q]}]

> 

> DynamicModule[{p = 0, q}, Dynamic[q = p + 1]; Dynamic[q]]

> 

> 

> 

> Luca

> 

> 




  • Prev by Date: Re: Re: EdgeRenderingFunction to produce edge labels in
  • Next by Date: Re: Select from list
  • Previous by thread: Dynamic (more)
  • Next by thread: List re-arrangement question