Logo

Programming-Idioms

History of Idiom 28 > diff from v81 to v82

Edit summary for version 82 by Dave Mason:
[Smalltalk] demo

Version 81

2021-12-21, 00:58:06

Version 82

2021-12-27, 06:14:21

Idiom #28 Sort by a property

Sort elements of array-like collection items in ascending order of x.p, where p is a field of the type Item of the objects in items.

Idiom #28 Sort by a property

Sort elements of array-like collection items in ascending order of x.p, where p is a field of the type Item of the objects in items.

Variables
items,x,p
Variables
items,x,p
Code
items sorted: [:x :y | x p <= y p].
Code
items sorted: [:x :y | x p <= y p].
Demo URL
https://pharojs.org/repl##(-4 1 -3 6 2) sorted: [ : x : y | x abs <= y abs ]