Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2013

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

Search the Archive

Re: Exercise of Programming with Mathematica

  • To: mathgroup at
  • Subject: [mg131962] Re: Exercise of Programming with Mathematica
  • From: Douglas Skinner <d_dubya_skinner at>
  • Date: Wed, 6 Nov 2013 00:37:44 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • References: <l3qrmm$3ps$>

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