Reputation
66,448
Next tag badge:
209/100 score
19/20 answers
Badges
6 195 287
Newest
 Nice Answer
Impact
~421k people reached

Feb
8
comment Retaining and reusing a one-to-one mapping from a sort
Well, I left that comment specifically for you to use it should you wish to do so. I posted another answer because it became clear that the OP wants SortBy-like behavior with a list of comparison functions, and it was more than just using Ordering.
Feb
8
awarded  Enlightened
Feb
8
comment Wavelets: Relative error vs compression ratio
+1. It's nice to see you here, Vivek!
Feb
8
comment Splicing a list of arguments into a function with Sequence
+1. The extent to which this can be called "bypassing" depends on whether or not SlotSequence (##) uses Sequence internally. One thing I am certain about is that both use the same underlying mechanism. In particular, Sequence @@ array can be also written as ##& @@ array (a form beloved by @Mr.Wizard). The discussion in comments below my answer to this question seems relevant here.
Feb
8
comment pointer like operations in mathematica and evaluation control
I think I've done something very similar to what you want in this answer
Feb
8
answered Retaining and reusing a one-to-one mapping from a sort
Feb
8
comment Retaining and reusing a one-to-one mapping from a sort
If I wanted to make this a separate answer, I would have done so at the start :). I think it would be better to start with order = Ordering@Ordering@ref, replacing the slower Position- based code, since people tend to pay more attention to things at the begining of the post. But this is up to you, of course.
Feb
8
comment Retaining and reusing a one-to-one mapping from a sort
Istvan, the way you compute order is really not efficient. Efficent way would be Ordering[Ordering[ref]], and that's all there is to it here, really (so you don't need your longer code using rules either) .
Feb
8
comment Retaining and reusing a one-to-one mapping from a sort
You most certainly can do this, just the ordering function would become more complex,and this can possibly degrade the efficiency. Another option is to construct a list with positions like Transpose[{lst,Range[Length[lst]]}],where lst is the original list, and use SortBy on this one, changing all your sorting functions as f-> First@f[#]&. Then, after a list is sorted, extract positions of elements of the original list in a sorted list as sorted[[All,2]].
Feb
8
comment Retaining and reusing a one-to-one mapping from a sort
Yes you can. Have a look at Ordering function.
Feb
8
awarded  Nice Answer
Feb
8
comment Splicing a list of arguments into a function with Sequence
@Guillochon This may be a good idea.
Feb
8
comment Splicing a list of arguments into a function with Sequence
@Guillochon Thanks for the accept, although you could have given it some more time - perhaps someone would come up with a better answer.
Feb
8
answered Splicing a list of arguments into a function with Sequence
Feb
8
revised Efficient code for tallying entries in very large lists
added 468 characters in body
Feb
8
revised Efficient code for tallying entries in very large lists
Made more fair speed comparison
Feb
8
comment Why doesn't Mathematica use uniform criteria for validating Options?
@Rojo Yes, I know. Back then, I did not know all that. Those packages were written 4-5 years ago, and definietely need an update / overhaul.
Feb
8
revised Efficient code for tallying entries in very large lists
Added a section on file-backed lists
Feb
7
answered Efficient code for tallying entries in very large lists
Feb
7
comment Why doesn't Mathematica use uniform criteria for validating Options?
@Rojo You really want to look at CheckOptions.m, since PackageOptionsChecks generailizes that to entire packages and adds convenient syntax, but it is quite likely that one does not need to change a single line in it and all changes need to be done on the CheckOptions.m. If this is the case, it would mean that I wasn't totally hopeless 4 years ago (actually, sometimes I think I was much better than than I am now).