MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Exercise of Programming with Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131962] Re: Exercise of Programming with Mathematica
  • From: Douglas Skinner <d_dubya_skinner at hotmail.com>
  • Date: Wed, 6 Nov 2013 00:37:44 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <l3qrmm$3ps$1@smc.vnet.net>

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



  • Prev by Date: Re: Mathematica not IEEE-754 compliant?
  • Next by Date: Re: PlotRange with Histogram Log height
  • Previous by thread: Re: Number Separator for Number Labels on Plot Axes
  • Next by thread: Re: Data format AFTER import into Mathematica from Excel.xls