MathGroup Archive 2005

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

Search the Archive

Re: this is ridiculous...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61813] Re: [mg61798] this is ridiculous...
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 31 Oct 2005 01:17:07 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

Use HoldPattern

Equal[d,2]/.HoldPattern[Equal[x__]]:>tree[x]
willow[d,2]/.willow[x__]:>tree[x]
$Version

tree[d, 2]

tree[d, 2]

"5.2 for Mac OS X (June 20, 2005)"


Bob Hanlon

> 
> From: Chris Chiasson <chris.chiasson at gmail.com>
To: mathgroup at smc.vnet.net
> Date: 2005/10/30 Sun AM 12:43:33 EDT
> Subject: [mg61813] [mg61798] this is ridiculous...
> 
> 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: graphing x^2+4 on x, y, and i
  • Next by Date: Re: Default argument and conditional pattern question
  • Previous by thread: Re: this is ridiculous...
  • Next by thread: Exporting notebooks to xml (cnxml)