Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: this is ridiculous...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61815] Re: [mg61798] this is ridiculous...
  • From: Selwyn Hollis <sh2.7183 at earthlink.net>
  • Date: Mon, 31 Oct 2005 01:17:08 -0500 (EST)
  • References: <200510300443.AAA09812@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Chris,

Equal[x__] evaluates to True (as does Equal[]). HoldPattern is the fix:

In:    Equal[d, 2] /. HoldPattern[Equal[x__]] :> tree[x]

Out:   tree[d,2]

---
  Selwyn Hollis


On Oct 30, 2005, at 12:43 AM, Chris Chiasson wrote:

> Can anyone replicate the pattern replacement problem I am having  
> with Equal?
>
> Cell[CellGroupData[{Cell[BoxData[{
>     RowBox[{
>       RowBox[{"Equal", "[",
>         RowBox[{"d", ",", "2"}], "]"}], "/.",
>       RowBox[{
>         RowBox[{"Equal", "[", "x__", "]"}], "\[RuleDelayed]",
>         RowBox[{"tree", "[", "x", "]"}]}]}], "\[IndentingNewLine]",
>     RowBox[{
>       RowBox[{"willow", "[",
>         RowBox[{"d", ",", "2"}], "]"}], "/.",
>       RowBox[{
>         RowBox[{"willow", "[", "x__", "]"}], "\[RuleDelayed]",
>         RowBox[{"tree", "[", "x", "]"}]}]}], "\[IndentingNewLine]",
>   "$Version"}], "Input",
>   CellLabel->"In[1]:="],
>
> Cell[BoxData[
>     RowBox[{"d", "\[Equal]", "2"}]], "Output",
>   CellLabel->"Out[1]="],
>
> Cell[BoxData[
>     RowBox[{"tree", "[",
>       RowBox[{"d", ",", "2"}], "]"}]], "Output",
>   CellLabel->"Out[2]="],
>
> Cell[BoxData["\<\"5.2 for Microsoft Windows (June 20, 2005)\"\>"], \
> "Output",
>   CellLabel->"Out[3]="]
> }, Open  ]]
>
> --
> http://chrischiasson.com/contact/chris_chiasson
>
>


  • Prev by Date: Re: this is ridiculous...
  • Next by Date: Re: Simplify further
  • Previous by thread: Re: this is ridiculous...
  • Next by thread: Re: this is ridiculous...