Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
(sort-by :p items)
		
		
	items.sort((a, b) => (a.p).compareTo(b.p));
		
		
	items.sort((a, b) => Comparable.compare(a.p, 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_key(|x| x.p);
		
		
	items.sort_by(|a,b| a.p.cmp(&b.p));
		
		
	items.sortBy(_.x)
		
		
	case class S(x: Int)
val items = List(S(3), S(4), S(2))
items.sortBy( item: S => item.x )
		
		
	(define-struct item (p x y) #:transparent)
(define items (list (item 1 2 3) (item 0 0 0) (item 5 2 1)))
(sort items < #:key item-p)
		
		
	items sorted: [:x :y | x p <= y p].