A rule with condition for the elements of a list
- To: mathgroup at smc.vnet.net
- Subject: [mg33132] A rule with condition for the elements of a list
- From: guillerm at aida.usal.es (Guillermo Sanchez)
- Date: Tue, 5 Mar 2002 03:08:33 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Given a list like this :
lst = {a, b, c*t, r*s, 2*t, 3, 0};
I would like build a rule (c -> c t) for each elements c of the list
that are not function of t that give like solution :
Out[] := {a t, b t, c t, r s t, 2 t, 3 t, 0}
I have tested the following way but they are not work
lst /. (c_ /; FreeQ[c, t]) -> c*t
and
integrate[c_, t_] := c t /; FreeQ[c, t]
lst /. c_ -> integrate[c, t]
I will appreciate your held
Guillermo Sanchez
- Follow-Ups:
- RE: A rule with condition for the elements of a list
- From: "Higinio Ramos" <higra@usal.es>
- Re: A rule with condition for the elements of a list
- From: Tomas Garza <tgarza01@prodigy.net.mx>
- RE: A rule with condition for the elements of a list