Answer by Michael E2 for Difference between Sort and SortBy
No one has mentioned the difference in performance:SeedRandom[0];data = RandomInteger[{-10000, 10000}, 10^5];sdata = Sort[data, Abs[#1] < Abs[#2] &]; // AccurateTimingsbdata = SortBy[data, Abs];...
View ArticleAnswer by Mr.Wizard for Difference between Sort and SortBy
I commented on this a bit here: What are the most common pitfalls awaiting new users?Since SortBy was introduced in Mathematica 6 it is preferred where applicable over Sort with a custom comparator....
View ArticleAnswer by MarcoB for Difference between Sort and SortBy
In general SortBy can do pretty much anything that Sort does; in some cases, possibly better or faster. You can find many comparisons on this site if you just search for both function names.I also...
View ArticleAnswer by nben for Difference between Sort and SortBy
SortBy is usually a more concise form of Sort, yes, but at times, you may have data that cannot be expressed, or cannot be expressed elegantly, using SortBy. For example, let's suppose that we want to...
View ArticleDifference between Sort and SortBy
I was playing with Sort. All examples I have come across so far, i.e Sort[{1, -1, 3, -3, 2, 5}, Abs[#1]<Abs[#2]&] can expressed in a shorter fashion using SortBy SortBy[{1, -1, 3, -3, 2, 5},...
View Article
More Pages to Explore .....