[Q] Thread[] and Hold[]
- To: mathgroup at smc.vnet.net
- Subject: [mg18785] [Q] Thread[] and Hold[]
- From: "Kevin Jaffe" <kj0 at mailcity.com>
- Date: Tue, 20 Jul 1999 01:33:37 -0400
- Sender: owner-wri-mathgroup at wolfram.com
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