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
>
>
- References:
- this is ridiculous...
- From: Chris Chiasson <chris.chiasson@gmail.com>
- this is ridiculous...