The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Re: Reordering lists?!
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Paul Abbott

Posts: 1,437
Registered: 12/7/04
Re: Reordering lists?!
Posted: Jul 30, 1996 2:56 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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


Paul Abbott
Department of Physics Phone: +61-9-380-2734
The University of Western Australia Fax: +61-9-380-1014
Nedlands WA 6907

Black holes are where God divided by zero

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.