MathGroup Archive 1999

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

Search the Archive

Re: Pattern example

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19309] Re: [mg19284] Pattern example
  • From: "Kevin J. McCann" <kevinmccann at Home.com>
  • Date: Sat, 14 Aug 1999 23:42:44 -0400
  • References: <199908140545.BAA10886@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

Chris,

Your replacement t_->c looks at the FullForm of the rest of your expression,
and takes the first object that satisfies t_ (which is anything), and
replaces it with c.  Thus you end up with the "unexpected result".

i.e. {{1+a},{2+a},{3+a}} fits the bill for "t_" and so mma replaces the
whole mess, it doesn't wait to see what is inside to do the replacement.

Kevin

----- Original Message -----
From: chris <senisen at ptty.loxinfo.co.th>
To: mathgroup at smc.vnet.net
Subject: [mg19309] [mg19284] Pattern example


<snip>

> Then
> {{1+a},{2+a},{3+a}}  /.  t_->c
> c
>  this is no more a list, but
>
> FullForm[{{1+a},{2+a},{3+a}}  /.  {t_}->c]
> List[c,c,c]
> shows it as a list
>
> What is behind this difference?




  • Prev by Date: Tricky Symbolizations with the Notation Package (Was Subscripts, Doh!!!)
  • Next by Date: Control Function With NDsolve
  • Previous by thread: Pattern example
  • Next by thread: Re: Pattern example