Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16175

Re: Exercise of Programming with Mathematica

From Douglas Skinner <d_dubya_skinner@hotmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Exercise of Programming with Mathematica
Date 2013-11-06 05:21 +0000
Message-ID <l5cjlf$4qc$1@smc.vnet.net> (permalink)
References <l3qrmm$3ps$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


Here's a solution which uses a postfix function. (Though I think Bill Rowe's solution is far more elegant.)

In[25]:= {{a, b}, {c, d}} // Reverse[#, {2}] & (* works for a list of two *)

Out[25]= {{b, a}, {d, c}}

In[26]:= {{a, b}, {c, d}, {e, f}} // Reverse[#, {2}] & (* works also for 3 *)

Out[26]= {{b, a}, {d, c}, {f, e}, {h, g}}

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Exercise of Programming with Mathematica Zhenyi Zhang <infozyzhang@gmail.com> - 2013-10-18 08:32 +0000
  Re: Exercise of Programming with Mathematica Helen Read <readhpr@gmail.com> - 2013-10-21 03:29 +0000
  Re: Exercise of Programming with Mathematica Douglas Skinner <d_dubya_skinner@hotmail.com> - 2013-11-06 05:21 +0000

csiph-web