RE: ReplaceAll doesn't replace
- To: mathgroup at smc.vnet.net
- Subject: [mg32566] RE: [mg32550] ReplaceAll doesn't replace
- From: "David Park" <djmp at earthlink.net>
- Date: Sun, 27 Jan 2002 03:28:55 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Ken, Map[f, expr] or f /@ expr applies f to each element on the first level in expr. But there is nothing at the first level of the expression x, so x is returned unchanged. #^2 & /@ x x and, of course, x /. x -> {a, b, c} {a, b, c} David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ > From: Ken Morgan [mailto:kmorga51 at calvin.edu] To: mathgroup at smc.vnet.net > > > I understand how the following will replace x with the list > > #^2 & /@ (x /. x -> {a, b, c}) > > to generate > > {a^2, b^2, c^2} > > But, why isn't x replaced at the beginning of the evaluation in the > following > > (#^2 & /@ x) /. x -> {a, b, c} > > since it generates > > {a, b, c} > > What I really want to know is: What is it about the Function function that > doesn't allow ReplaceAll to "replace all" at the beginning of an > evaluation? > > Thanks, > Ken Morgan > kmorga51 at calvin.edu > >