sort (List) or sort (List, x[index] or x.parameter)
sort (List) → List It creates a new list by sorting the elements of the given list in ascending order.
sort (List,x[index]) → List of list It creates a new list by sorting the elements based on given index for the list of lists.
sort (List,x[index]) → List of objects It creates a new list of objects by sorting the objects based on given parameter.
Example:
<br><O N="sortObject1" T="Project" Category="Functions" TransAlignRule="1"><br> <!-- created by ParamML Examples on 8/24/2023 --><br> <P N="List" V="[5,3,10,7,1]" /><br> <P N="sorted_List" V="sort(List)" /><br> <P N="List2" V="[[1,2],[10,5],[4,8],[2,1]]" /><br> <P N="sorted_List2" V="sort(List2,x[0])" /><br> <O N="Object1" T="Group"><br> <P N="a" V="7" /><br> </O><br> <O N="Object2" T="Group"><br> <P N="a" V="15" /><br> </O><br> <O N="Object3" T="Group"><br> <P N="a" V="3" /><br> </O><br> <O N="Object4" T="Group"><br> <P N="a" V="11" /><br> </O><br> <P N="List3" V="[Object1,Object2,Object3,Object4]" /><br> <P N="Sorted_list3" V="sort(List3,x.a)" /><br></O><br>

As illustrated above, sorted_List sorts the numerical elements while sorted_List2 sorts a list of list based on the first element on each sublist and sorted_List3 sorts a list of objects based on the value of “a” parameter.
To view this example in the library, see (https://openbrim.org/app/?incubator=1&author=ParamML_Examples_OpenBrIM+Platform&obj=objidc1cp27ykn9n8ejzdaiwjfl )
Last updated