Re: Comparison between Mathematica and other
- To: mathgroup at smc.vnet.net
- Subject: [mg92577] Re: Comparison between Mathematica and other
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Mon, 6 Oct 2008 04:14:35 -0400 (EDT)
On 10/5/08 at 6:06 AM, siegman at stanford.edu (AES) wrote: >2) Now it's certainly true that if you want to modify the default >behavior of Sort[ ], you do indeed have to be able to do (or more >likely copy and modify) what I'd agree is some very modest level of >procedural programming, as well illustrated in the example above: >Re[#2[[1]]] < Re[#1[[1]]] || Re[#2[[1]]] == Re[#1[[1]]] && >Im[#2[[1]]] < Im[#1[[1]]] &]] But this need not have been done this way. It could have been done: Ordering@(Re/@{##}) || Equal@@(Re/@{##}) && Ordering@(Im/@{##})& From the perspective of someone not familiar with Mathematica and its notation, this version is undoubtedly more opaque. But for me, this is much clearer and easier to read. The issue of determining what is being grouped by the numerous square brackets has been eliminated.