Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Why Integer[_] is not equivalent to _Integer?' topicStudent Support Forum > General > Archives > "Why Integer[_] is not equivalent to _Integer?"

Next Comment >Help | Reply To Topic
Author Comment/Response
Dims
04/25/10 12:45pm

If all integers have a Head of Integer, then why they do no match with pattern Integer[_]?

Log:

In[56]:= {1, 2, tt[3], 4.}

Out[56]= {1, 2, tt[3], 4.}

In[57]:= mylist = %

Out[57]= {1, 2, tt[3], 4.}

In[58]:= Position[mylist, tt[_]]

Out[58]= {{3}}

In[59]:= Position[mylist, Integer[_]]

Out[59]= {}

In[60]:= Head[mylist[[2]]]

Out[60]= Integer

In[61]:= Head[mylist[[3]]]

Out[61]= tt

In[62]:= Position[mylist, _Integer]

Out[62]= {{1}, {2}, {3, 1}}

URL: ,

Subject (listing for 'Why Integer[_] is not equivalent to _Integer?')
Author Date Posted
Why Integer[_] is not equivalent to _Integer? Dims 04/25/10 12:45pm
Re: Why Integer[_] is not equivalent to _Integer? yehuda ben-s... 05/02/10 11:39am
Next Comment >Help | Reply To Topic