MathGroup Archive 1999

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

Search the Archive

Re: Pattern example


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