Re: Reordering lists?!
- To: mathgroup at smc.vnet.net
- Subject: [mg4527] Re: Reordering lists?!
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Wed, 7 Aug 1996 04:17:36 -0400
- Organization: University of Western Australia
- Sender: owner-wri-mathgroup at wolfram.com
Andre and Alain wrote:
> Hey! I have a list of Numbers, 1 to 4, and wish to rescale them so
> that 1 replkaces 4 and 3 replaces 2 and 2 replaces 3 etc. I made a
> little code to do this on an element per element basis and it doesn't
> seem to do
> it! Could someone let me know what I'm doing wrong or whether it's a
> Mma problem? Thanks
Why not just use
list /. {4->1,3->2,2->3,1->4}
which will do what you want ...
Cheers,
Paul
_________________________________________________________________
Paul Abbott
Department of Physics Phone: +61-9-380-2734
The University of Western Australia Fax: +61-9-380-1014
Nedlands WA 6907 paul at physics.uwa.edu.au
AUSTRALIA http://www.pd.uwa.edu.au/Paul
Black holes are where God divided by zero
_________________________________________________________________
==== [MESSAGE SEPARATOR] ====