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


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

Re: Transfer dynamic into static variables

From John Fultz <jfultz@wolfram.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Transfer dynamic into static variables
Date 2012-03-02 12:54 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jiqfu8$84$1@smc.vnet.net> (permalink)
References <201203011030.FAA13120@smc.vnet.net>

Show all headers | View raw


Dynamic's only useful and interesting purpose is to exist as output in a space on the screen. If you're assigning it to the variable 'tl', then 'tl' is pretty useless unless it ends up on the screen.  So I'm left a little confused as to exactly what you're trying to accomplish.

Without more context, it's difficult for me to know exactly how to answer your question, but I'll give it two tries.

1) The Dynamic expression in tl is no different in essence than a Hold[]-wrapped expression. And so using standard expression-manipulation techniques.  E.g., tl2 = First[tl] literally does what you want.  But it's only going to do so at the snapshot in time when 'tl2 = First[tl]' is evaluated.

2) You could keep 'tl2' up to date by doing the assignment inside the Dynamic.
Dynamic[tl2 = {{a, "tst1"}, {c, "tst2"}}]
which would allow 'tl2' to track the variables 'a' and 'c' if they end up changing. Of course, it will only stay up-to-date when the Dynamic is updating, which will only happen if the Dynamic has an onscreen presence.

Sincerely,

John Fultz
jfultz@wolfram.com
User Interface Group
Wolfram Research, Inc.


On Mar 1, 2012, at 4:30 AM, Dominik Hezel wrote:

> Hallo,
>
> I have a complex program and now I need to convert a list with dynamic content into a list with static content, hence (simplified):
>
> tl = Dynamic[{{a, "tst1"}, {c,"tst2"}}]
>
> into
>
> tl2 ={{a, "tst1"}, {c,"tst2"}}
>
> So I can start doing normal list operations such as Extract, DeleteCases, etc. If this doesn't work I'll have quite a problem. So I'd really appreciate any advice.
>
> thanks,  Dominik
>

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


Thread

Re: Transfer dynamic into static variables John Fultz <jfultz@wolfram.com> - 2012-03-02 12:54 +0000
  Re: Transfer dynamic into static variables Dominik Hezel <sendme2000@me.com> - 2012-03-14 05:39 +0000

csiph-web