a question about pattern replacements
- To: mathgroup at smc.vnet.net
- Subject: [mg36163] a question about pattern replacements
- From: Sidney Cadot <sidney at jigsaw.nl>
- Date: Fri, 23 Aug 2002 21:34:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi all, While playing arounf with patterns and substitutions, I came across the following behavior which I didn't expect: z := SomeHead[{{1, 2}, {3, 4}}] z /. {SomeHead[q_] -> Flatten[q]} While this _does_ yield the desired result {1,2,3,4}, Mathematica complains: Flatten::"normal": Nonatomic expression expected at position 1 in Flatten[q]. ........as if it is trying to evaluate Flatten[q], with q not bound to {{1,2},{3,4}}. Could anybody explain why this happens? Best regards, Sidney Cadot