Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #16487
| From | Yi Wang <tririverwangyi@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Default value in pattern matching |
| Date | 2014-01-28 11:05 +0000 |
| Message-ID | <lc82u0$3u8$1@smc.vnet.net> (permalink) |
| References | <lbdjjl$58f$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
Actually, the property I looked after is not that Plus has a default value (though it is an insignificant part of the story), but that Plus has attribute OneIdentity, which affects pattern matching.
SetAttributes[myPlus, OneIdentity]
Default[myPlus] = 0;
a /. {myPlus[a, b_.] -> "matched"}
Out[] = "matched"
The example given here is not exactly as the one in my question. But this is enough for my purpose.
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar
Default value in pattern matching Yi Wang <tririverwangyi@gmail.com> - 2014-01-18 10:04 +0000 Re: Default value in pattern matching Yi Wang <tririverwangyi@gmail.com> - 2014-01-28 11:05 +0000
csiph-web