Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating resource.
Please try to avoid dependencies to third-party libraries and frameworks.
(sort-by :p items)
Array.Sort(items, (a, b) => compareFunc(a.p, b.p));
items.sort((a, b) => Comparable.compare(a.p, b.p));
items.sort((a, b) => (a.p).compareTo(b.p));
Enum.sort_by(items, &(&1.p))
items.sort { x, y -> x.p <=> y.p }
items.sort { x -> x.p }
sortBy (comparing p) items
items.sort(function(a,b) { return compareFieldP(a.p, b.p); });
items.sortedBy { it.p }
(sort #'< items :key #'p)
table.sort(items, function(a,b) if a.p < b.p then return true end end)
function cmp($a, $b) { if ($a->p == $b->p) { return 0; } return ($a->p < $b->p) ? -1 : 1; } usort($items, 'cmp');
@items = sort { $a->{p} cmp $b->{p} } @items;
items = sorted(items, key=lambda x: x.p)
items.sort_by(&:p)
items.sort_by(|a,b|a.p.cmp(&b.p));
items.sort_by_key(|item| item.p);
case class S(x: Int) val items = List(S(3), S(4), S(2)) items.sortBy( item: S => item.x )
items.sortBy(_.x)