A more efficient atop(ptoa(p), wantPermuted) would be
function(p, wantPermuted){return p.map(function(i){return wantPermuted[i];});}
This makes a new array instead of permuting wantPermuted, but if Factoradic used an indexof reverse index here and a user wanted (to pass in) a wantPermuted copy anyway, that'd be two new arrays...
...I'll just write the indexof approach here sometime.
A more efficient
atop(ptoa(p), wantPermuted)would beThis makes a new array instead of permuting
wantPermuted, but if Factoradic used anindexofreverse index here and a user wanted (to pass in) awantPermutedcopy anyway, that'd be two new arrays......I'll just write the indexof approach here sometime.