MathGroup Archive 2006

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

Search the Archive

Re: Rules


On 10 mag 2006, at 12:34, 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}
> AList /. rule1
> what is the difference between the two?

 From the help for ReplaceAll:

expr /. rules applies a rule or list of rules in an attempt to  
transform EACH SUBPART of an expression expr.

so AList /. {rule1} and AList /. {rule1} are equivalent if rule1 is a  
Rule expression.

> 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?
>

 From the help for Replace:

Replace[expr, rules] applies a rule or list of rules in an attempt to  
transform the ENTIRE expression expr


Adriano Pascoletti




  • Prev by Date: Re: Mathematica Question
  • Next by Date: Re: Creating a new table using values from a column in another table,
  • Previous by thread: Rules
  • Next by thread: Re: Rules