Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!boingo.med.jhu.edu!haven!ni.umd.edu!uc780.umd.edu!cs450a03 From: cs450a03@uc780.umd.edu Newsgroups: comp.lang.apl Subject: RE: WANTED: a way to sort array so each column is in des Message-ID: <13APR91.22583472@uc780.umd.edu> Date: 13 Apr 91 22:58:34 GMT References: <31931@usc> Sender: usenet@ni.umd.edu (USENET News System) Organization: The University of Maryland University College Lines: 33 Nntp-Posting-Host: uc780.umd.edu A Analla writes: >Could some please suggest a generic function to reorder each column >of an array in descending order where the array is two dimensional. >I would prefer the solution not be iterative and not require breaking >the columns into separate vectors. Well, in general, if you want to order the columns independently, you are already treating them as separate vectors. If you are using J, I'd suggest something like: \:"1&.|: array However, if you are using vs-apl, I'd recommend you write a function which iterates over the columns: _ V Y <- F Y ;LP ;N ->(LP <- ((minus1 take rho Y)rho LOOP), END)[N <- quadIO] LOOP:Y[;N] <- Y[gradedown Y;N] ->LP[N <- N+1] END: _ V I could go on, but maybe you could say what version of APL you are working with? Or maybe I misunderstood your problem? Raul Rockwell