Anonymous user
Sort a list of object identifiers: Difference between revisions
→Using QuickSort
Line 681:
We can make any OID as array of numbers and we can put all OIDs in an array to sort by a custom Quick Sort, where we place the compare function as a lambda function. Swaps made to pointers of arrays of OIDs. There is no need to use PIECE$() in compare function.
Note that QuickSort need Lower or Equal
There is a Let numeric_expression = string_expression
Normally this numeric_expression = string_expression is a syntax error,
but Let is a two part statement, a Push to stack and a Read from stack: Push string_expression : Read numeric_expression
So first executed the string expression which return a pointer to array and then the read statement get this pointer;
<lang M2000 Interpreter>
|