Re: Rules
- To: mathgroup at smc.vnet.net
- Subject: [mg66378] Re: Rules
- From: dh <dh at metrohm.ch>
- Date: Thu, 11 May 2006 02:15:05 -0400 (EDT)
- References: <e3shji$m3u$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Marcin
see below, Daniel
Marcin Rak wrote:
> Hey everyone,
>
> I had two simple questions, and was wondering wether anyone could through
> something my way:
>
> 1) When we have a list, call it AList, and we type the following
> AList /. {rule1}
braces are needed when you have more than one rule
> AList /. rule1
> what is the difference between the two? And, how would I go about
> defining a rule for the variable AList, and a rule for the contents of the
> list - obviously these are two different concepts, yet how would you
> differentiate b/w the two?
A rule for a whole list:
{1, 2, 3} /. {a_, b_, c_} -> {a, c}
or a rule for single elemnts:
{1, 2, 3} /. 2->5
>
> Thanx to all
> MR
>