From ... From: Erik Naggum Subject: Re: question on sort Date: 2000/08/01 Message-ID: <3174145458945605@naggum.net>#1/1 X-Deja-AN: 653314063 References: mail-copies-to: never Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsmaster@eunet.no X-Trace: oslo-nntp.eunet.no 965156677 17004 195.0.192.66 (1 Aug 2000 19:04:38 GMT) Organization: Naggum Software; vox: +47 8800 8879; fax: +47 8800 8601; http://naggum.no; http://naggum.net User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7 Mime-Version: 1.0 NNTP-Posting-Date: 1 Aug 2000 19:04:38 GMT Newsgroups: comp.lang.lisp * kp gores | unfortunately they sort only sequences or vectors. A sequence is a list or a vector. | I'd like to sort arrays of whatever dimensions (my array is (* 6)). | The key should be a element in the array (eg. accessor for column 2). | does a fast and flexible implentation of sort/stable-sort for arbitrary | array exist somewhere on the net? Build a vector of the appropriate size with all the keys in it: (let ((keys (make-array ))) (dotimes (i ) (setf (aref keys i) i)) keys) Sort the keys vector, using a :key argument that retrieves the value from your array with the value in the keys vector as index. If you absolutely have to, rearrange your multidimensional array. Otherwise, you just use an indirection through the sorted keys vector. I consider the above an example of a pattern in Common Lisp, btw. #:Erik -- If this is not what you expected, please alter your expectations.