MathGroup Archive 2009

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

Search the Archive

Re: problem writing debugging utility function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100452] Re: problem writing debugging utility function
  • From: Stonewall Ballard <stoneyb at gmail.com>
  • Date: Thu, 4 Jun 2009 03:34:06 -0400 (EDT)
  • References: <gvq09k$mqv$1@smc.vnet.net> <200905311037.GAA17048@smc.vnet.net>

Leonid,

This is a really good explanation of evaluation. I'm still struggling
to internalize this, even after using Mathematica for years. I'm
curious about one point you raised. In this example:

> In[7] = Function[y, (Print["Just before calling f"]; f[y]),
> HoldAll][Print["*"]]
>
> Just before calling f
>
> *
>
> Out[7]= {Hold[Null],Symbol}

the result is different than when leaving off the explicit HoldAll:

In[32]:= Function[y, (Print["Just before calling f"]; f[y])][
 Print["*"]]

During evaluation of In[32]:= *

During evaluation of In[32]:= Just before calling f

Out[32]= f[Null]

Yet the documentation for Function says:
  Function has attribute HoldAll. The function body is evaluated only
after the formal parameters have been replaced by arguments.

How is the explicit HoldAll attribute different from the inherent
HoldAll? Why doesn't Function normally act as with the explicit
HoldAll?

Thanks.


  • Prev by Date: Automatically adding bottom frame line to cells without output?
  • Next by Date: Re: Integrate Bug
  • Previous by thread: Re: Re: problem writing debugging utility function
  • Next by thread: Re: Re: problem writing debugging utility function