select. Selecting elements   [3.4.6]


^table.select[key;value](selection_criterion)
^table.select[key;value](selection_criterion)[options]

The method looks through the hash element by element, examining each row in respect to the specified
criterion (a mathematical expression). The elements which satisfy the criterion (returned Boolean value is "true") are added to the result hash.

Options hash can be specified:

$.limit(maximum)
Maximum number of rows to be selected
$.reverse(false/true)
true=process elements in the reverse order


Example
$men[
   $.Stephen(26)
   $.Alex
(20)
   $.
Michael(29)
   $.Denis(30)
]


$thoseAbove20[^men.select[;age]($age > 20)
[ $.limit(2) ]]

Variable
$thoseAbove20 will contain elements Stephen and Michael.


Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 27.01.2021