Re: Re: Dynamic: feature?
- To: mathgroup at smc.vnet.net
- Subject: [mg88092] Re: [mg88068] Re: Dynamic: feature?
- From: John Fultz <jfultz at wolfram.com>
- Date: Thu, 24 Apr 2008 05:57:52 -0400 (EDT)
- Reply-to: jfultz at wolfram.com
On Wed, 23 Apr 2008 04:10:12 -0400 (EDT), Jean-Marc Gulliet wrote: > Chris Osborn wrote: > >> I have a cell containing this: >> >> Dynamic[f[a, b]] >> >> Then I do this: >> >> a /: f[a, b] = 12 >> >> and the dynamic cell updates to 12, as I would expect. >> >> When I do this: >> >> b /: f[a, b] = 45 >> >> The dynamic cell does *not* update for some reason. >> It seems as though it does not realize an update has occurred when it >> is associated with b. >> >> Does anyone know why this is? >> >> Thanks in advance, >> Chris >> > Weird. I witness the same behavior if the cells are evaluated in the > given order. However, ff one change the order of the assignments (i.e. b > first, then a) Dynamic[] works as expected. Evaluating the following > expressions in that order, > > Dynamic[f[a, b]] > (* The first output cell is: f[a, b] *) > > b /: f[a, b] = 45 > (* The first output cell is now: 45 *) > > a /: f[a, b] = 12 > (* The first output cell is now: 12 *) > > $Version => "6.0 for Mac OS X x86 (64-bit) (February 7, 2008)" > > I have also recorded the sessions in a PDF file. See > > http://homepages.nyu.edu/~jmg336/mathematica/weirddynamic.pdf > > Regards, > -- Jean-Marc A principle rule of debugging Dynamics...consider what Shift-Enter evaluations do. In this case, exactly the same thing. In fact, Dynamic correctly reflects what a Shift-Enter evaluation on f[a,b] would do at that very moment. Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc.