Re: Monitor bug or feature
- To: mathgroup at smc.vnet.net
- Subject: [mg84124] Re: Monitor bug or feature
- From: dh <dh at metrohm.ch>
- Date: Mon, 10 Dec 2007 20:45:51 -0500 (EST)
- References: <fjj1nk$g5b$1@smc.vnet.net>
Hi Mark,
there is more than meets the eye. Normally the arguments of a function
are evaluated before feeding them to the function. To prevent this there
are attributes like HoldAll and HoldFirst. Monitor has HoldAll.
Therefore, in your first example Monitor gets an expression to monitor.
However, in the second example with the pure function, the Table gets
evaluated and Monitor gets a list of integers.
hope this helps, Daniel
Mark Fisher wrote:
> Hi all,
>
> Monitor[Table[Pause[.1]; i, {i, 10}], i]
>
> works as I expected, but
>
> Table[Pause[.1]; i, {i, 10}] // Monitor[#, i] &
>
> does not: It does not produce any "monitoring".
>
> Are there other examples where
>
> f[x, a]
>
> and
>
> f[#,a]&[x]
>
> produce different "effects". (Clearly the Heads of the expressions are
> different.)
>
> I'm guessing my surprise regarding this feature of Monitor reflects
> the fact that I really haven't made any attempt to understand Dynamic
> etc.
>
> --Mark
>