Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Why does _+_==2_ (or, why is HoldPattern required for
Replies: 5   Last Post: Jan 22, 2014 3:27 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Alan

Posts: 95
Registered: 3/29/11
Re: Why does _+_==2_ (or, why is HoldPattern required
Posted: Jan 22, 2014 3:27 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 1/20/2014 10:42 PM, Itai Seggev wrote:
> MatchQ[x+x, _+_] would return False


That is actually much less surprising to me:
one expects evaluation of the first expression.
What is quite surprising is that `_+_` does
not stand for any+thing, `_*_` does
not stand for any*thing, etc.
(Not unless one uses HoldPattern.)
I do not consider these "edge cases".

As you say, a decision had to be made.
I am just trying to understand the decision.
Your answer that it treats all symbolic expressions
equally is very likely a good answer in the end,
but of course on its own it begs the question.

Thanks,
Alan Isaac





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.