[Date Index]
[Thread Index]
[Author Index]
Re: [Q] Thread[] and Hold[]
*To*: mathgroup at smc.vnet.net
*Subject*: [mg18803] Re: [mg18785] [Q] Thread[] and Hold[]
*From*: "Richard Finley" <rfinley at medicine.umsmed.edu>
*Date*: Thu, 22 Jul 1999 08:19:23 -0400
*Sender*: owner-wri-mathgroup at wolfram.com
Kevin,
It seems to make sense to me given the definition of Thread. In essence,
Thread[{Hold[a],Hold[b],Hold[c]},Hold] will thread the List function over
the arguments that have the head Hold...namely a,b,and c so you end up
with Hold[{a,b,c}]. It is probably more obvious if you use a generic
function rather than List....for example:
Thread[f[Hold[a],Hold[b],Hold[c]],Hold] which will then give the result:
Hold[f[a,b,c]]
Now just imagine substituting List for f and you will see what is
happening. Hope that helps...RF
>>> "Kevin Jaffe" <kj0 at mailcity.com> 07/19/99 11:33PM >>>
to comp.soft-sys.math.mathematica, I learned a neat, but rather
puzzling, trick:
In[4]:= Thread[Hold[{a,b,c}]] (* This I understand *)
Out[4]= {Hold[a], Hold[b], Hold[c]}
In[5]:= Thread[%, Hold] (* This baffles me *)
Out[5]= Hold[{a, b, c}]
I can't explain why the form in [5] would be the inverse of the form
in [4], but be that as it may, with this maneuver one can do nifty
things like:
In[16]:= Thread[{Hold[1 + 1], Hold[3^2], Hold[3*6]}, Hold]
2
Out[16]= Hold[{1 + 1, 3 , 3 6}]
Neither under Thread nor Hold could I find any explanation in the
Mathematica Book for the behavior in [5]. Does anybody know an
explanation for it?
Thanks,
KJ
Get your FREE Email at http://mailcity.lycos.com
Get your PERSONALIZED START PAGE at http://my.lycos.com
Prev by Date:
**Re: Limit of an Integer Function**
Next by Date:
**Re: How NDSolve counts Conditions**
Previous by thread:
**Re: [Q] Thread[] and Hold[]**
Next by thread:
**Re: [Q] Thread[] and Hold[]**
| |