MathGroup Archive 1999

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

Search the Archive

Pattern example

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19284] Pattern example
  • From: senisen at ptty.loxinfo.co.th (chris)
  • Date: Sat, 14 Aug 1999 01:45:11 -0400
  • Organization: My Org
  • Sender: owner-wri-mathgroup at wolfram.com

I am trying to learn how to use patterns and replacements,
for instance this example:

{{1+a},{2+a},{3+a}}  /.  {t_+a}->c
 {c,c,c}

FullForm[{{1+a},{2+a},{3+a}}  /.  {t_+a}->c]
FullForm= List[c,c,c]

So far so good

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?

Chris


  • Prev by Date: Multiple html links
  • Next by Date: Re: circumference of an ellipse
  • Previous by thread: Multiple html links
  • Next by thread: Re: Pattern example