Qore Programming Language Reference Manual  0.8.12.8
List Functions

Functions

bool Qore::inlist ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
bool Qore::inlist (any arg, nothing x)
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
bool Qore::inlist (any arg, softlist l)
 Returns True if the first argument is a member of the second argument list using soft comparisons (with implicit type conversions), False if not. More...
 
bool Qore::inlist_hard ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
bool Qore::inlist_hard (any arg, nothing x)
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
bool Qore::inlist_hard (any arg, softlist l)
 Returns True if the first argument is a member of the second argument list using hard comparisons (without any implicit type conversions), False if not. More...
 
any Qore::max (list l)
 Returns the maximum value in a list. More...
 
any Qore::max (list l, string func)
 Returns the maximum value in a list; accepts the name of a function to use to compare complex data types or to give a special sort order. More...
 
any Qore::max (list l, code f)
 Returns the maximum value in a list; accepts a call reference or a closure to use to compare complex data types or to give a special sort order. More...
 
any Qore::max (...)
 Returns the maximum value of the arguments passed to the function. More...
 
any Qore::min (list l)
 Returns the minumum value in a list. More...
 
any Qore::min (list l, string func)
 Returns the minumum value in a list; accepts the name of a function to use to compare complex data types or to give a special sort order. More...
 
any Qore::min (list l, code f)
 Returns the minumum value in a list; accepts a call reference or a closure to use to compare complex data types or to give a special sort order. More...
 
any Qore::min (...)
 Returns the minumum value of the arguments passed to the function. More...
 
list Qore::range (int start, int stop, int step=1)
 Returns a list containing an arithmetic progression of integers. More...
 
list Qore::range (int stop)
 Returns a list containing an arithmetic progression of integers with start = 0 and step = 1. More...
 
nothing Qore::reverse ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
list Qore::reverse (list l)
 Reverses a list and returns the new list. More...
 
any Qore::sort (any arg)
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
list Qore::sort (list l)
 Performs an unstable sort in ascending order and returns the new list. More...
 
list Qore::sort (list l, string func)
 Performs an unstable sort in ascending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order. More...
 
list Qore::sort (list l, code f)
 Performs an unstable sort in ascending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order. More...
 
any Qore::sortDescending (any arg)
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
list Qore::sortDescending (list l)
 Performs an unstable sort in descending order and returns the new list. More...
 
list Qore::sortDescending (list l, string func)
 Performs an unstable sort in descending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order. More...
 
list Qore::sortDescending (list l, code f)
 Performs an unstable sort in descending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order. More...
 
any Qore::sortDescendingStable (any arg)
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
list Qore::sortDescendingStable (list l)
 Performs a stable sort in descending order and returns the new list. More...
 
list Qore::sortDescendingStable (list l, string func)
 Performs a stable sort in descending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order. More...
 
list Qore::sortDescendingStable (list l, code f)
 Performs a stable sort in descending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order. More...
 
any Qore::sortStable (any arg)
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
list Qore::sortStable (list l)
 Performs a stable sort in ascending order and returns the new list. More...
 
list Qore::sortStable (list l, string func)
 Performs a stable sort in ascending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order. More...
 
list Qore::sortStable (list l, code f)
 Performs a stable sort in ascending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order. More...
 
any Qore::sort_descending (any arg)
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
list Qore::sort_descending (list l)
 Performs an unstable sort in descending order and returns the new list. More...
 
list Qore::sort_descending (list l, string func)
 Performs an unstable sort in descending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order. More...
 
list Qore::sort_descending (list l, code f)
 Performs an unstable sort in descending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order. More...
 
any Qore::sort_descending_stable (any arg)
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
list Qore::sort_descending_stable (list l)
 Performs a stable sort in descending order and returns the new list. More...
 
list Qore::sort_descending_stable (list l, string func)
 Performs a stable sort in descending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order. More...
 
list Qore::sort_descending_stable (list l, code f)
 Performs a stable sort in descending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order. More...
 
any Qore::sort_stable (any arg)
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
list Qore::sort_stable (list l)
 Performs a stable sort in ascending order and returns the new list. More...
 
list Qore::sort_stable (list l, string func)
 Performs a stable sort in ascending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order. More...
 
list Qore::sort_stable (list l, code f)
 Performs a stable sort in ascending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order. More...
 

Detailed Description

List functions

Function Documentation

◆ inlist() [1/3]

bool Qore::inlist ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP

◆ inlist() [2/3]

bool Qore::inlist ( any  arg,
nothing  x 
)

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP

◆ inlist() [3/3]

bool Qore::inlist ( any  arg,
softlist  l 
)

Returns True if the first argument is a member of the second argument list using soft comparisons (with implicit type conversions), False if not.

Code Flags:
RET_VALUE_ONLY
Example:
if (inlist(str, strlist))
printf("%y is in %y\n", str, strlist);
Parameters
argthe argument to look for in the list
lthe list to search for the first argument arg
Returns
True if the first argument is a member of the second argument list using soft comparisons (with implicit type conversions), False if not
See also
inlist_hard(any, softlist)

◆ inlist_hard() [1/3]

bool Qore::inlist_hard ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP

◆ inlist_hard() [2/3]

bool Qore::inlist_hard ( any  arg,
nothing  x 
)

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP

◆ inlist_hard() [3/3]

bool Qore::inlist_hard ( any  arg,
softlist  l 
)

Returns True if the first argument is a member of the second argument list using hard comparisons (without any implicit type conversions), False if not.

Code Flags:
RET_VALUE_ONLY
Example:
if (inlist_hard(str, strlist))
printf("%y is in %y\n", str, strlist);
Parameters
argthe argument to look for in the list
lthe list to search for the first argument arg
Returns
True if the first argument is a member of the second argument list using hard comparisons (without any implicit type conversions), False if not
See also
inlist(any, softlist)

◆ max() [1/4]

any Qore::max ( list  l)

Returns the maximum value in a list.

This variant will only work on basic data types

Code Flags:
CONSTANT
Example:
any v = max(l);
Parameters
lthe list to process
Returns
the maximum value in a list
See also
min(list)

◆ max() [2/4]

any Qore::max ( list  l,
string  func 
)

Returns the maximum value in a list; accepts the name of a function to use to compare complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY
Example:
any v = max(l, "my_sort_function");
Parameters
lthe list to sort
functhe name of a function accessible in the current scope that accepts 2 arguments of the data type in the list; the function must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the maximum value in a list
See also
min(list, string)

◆ max() [3/4]

any Qore::max ( list  l,
code  f 
)

Returns the maximum value in a list; accepts a call reference or a closure to use to compare complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY
Example:
code sort_func = int sub (hash l, hash r) { return l.id <=> r.id; };
any v = max(l, sort_func);
Parameters
lthe list to sort
fa call reference or a closure that accepts 2 arguments of the data type in the list; the call reference or a closure must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the maximum value in a list
See also
min(list, code)

◆ max() [4/4]

any Qore::max (   ...)

Returns the maximum value of the arguments passed to the function.

This variant will only work on basic data types

Code Flags:
CONSTANT
Example:
any v = max(v1, v2, v3);
Parameters
...the list of values to process given directly to the function
Returns
the maximum value in a list
See also
min(...)

◆ min() [1/4]

any Qore::min ( list  l)

Returns the minumum value in a list.

This variant will only work on basic data types

Code Flags:
CONSTANT
Example:
any v = min(l);
Parameters
lthe list to process
Returns
the minumum value in a list
See also
max(list)

◆ min() [2/4]

any Qore::min ( list  l,
string  func 
)

Returns the minumum value in a list; accepts the name of a function to use to compare complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY
Example:
any v = min(l, "my_sort_function");
Parameters
lthe list to sort
functhe name of a function accessible in the current scope that accepts 2 arguments of the data type in the list; the function must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the minumum value in a list
See also
max(list, string)

◆ min() [3/4]

any Qore::min ( list  l,
code  f 
)

Returns the minumum value in a list; accepts a call reference or a closure to use to compare complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY
Example:
code sort_func = int sub (hash l, hash r) { return l.id <=> r.id; };
any v = min(l, sort_func);
Parameters
lthe list to sort
fa call reference or a closure that accepts 2 arguments of the data type in the list; the call reference or a closure must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the minumum value in a list
See also
max(list, code)

◆ min() [4/4]

any Qore::min (   ...)

Returns the minumum value of the arguments passed to the function.

This variant will only work on basic data types

Code Flags:
CONSTANT
Example:
any v = min(v1, v2, v3);
Parameters
...the list of values to process given directly to the function
Returns
the minumum value in a list
See also
max(...)

◆ range() [1/2]

list Qore::range ( int  start,
int  stop,
int  step = 1 
)

Returns a list containing an arithmetic progression of integers.

Code Flags:
RET_VALUE_ONLY
Example:
range(2, 5); # (2, 3, 4, 5)
range(2, -2); # (2, 1, 0, -1, -2)
range(1, 10, 5); # (1, 6)
range(0, 10, 5); # (0, 5, 10)
range(-10, 10, 5); # (-10, -5, 0, 5, 10)
range(10, -10, 5); # (10, 5, 0, -5, -10)
Parameters
startthe initial value
stopthe final value
stepthe step; the default is 1; must be greater than 0; the function throws a RANGE-ERROR exception when this argument is < 1
Returns
Returns a list containing an arithmetic progression of integers.
Exceptions
RANGE-ERRORthis exception is thrown if step < 1
See also
xrange
Note
the main difference between range() and xrange() is that range returns real list and xrange returns a RangeIterator
Since
Qore 0.8.6

◆ range() [2/2]

list Qore::range ( int  stop)

Returns a list containing an arithmetic progression of integers with start = 0 and step = 1.

This is an overloaded version of range(int, int, int) meaning range(0, stop, 1)

Code Flags:
CONSTANT
Example:
range(1); # (0, 1)
range(-3); # (0, -1, -2, -3)
Parameters
stopthe final value
Returns
Returns a list containing an arithmetic progression of integers with start = 0 and step = 1.
See also
xrange
Note
the main difference between range() and xrange() is that range returns real list and xrange returns a RangeIterator
Since
Qore 0.8.6

◆ reverse() [1/2]

nothing Qore::reverse ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP

◆ reverse() [2/2]

list Qore::reverse ( list  l)

Reverses a list and returns the new list.

Code Flags:
CONSTANT
Example:
list nl = reverse(l);
Parameters
lthe list to reverse
Returns
the given list with all elements in reverse order
See also
reverse(string)

◆ sort() [1/4]

any Qore::sort ( any  arg)

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP

◆ sort() [2/4]

list Qore::sort ( list  l)

Performs an unstable sort in ascending order and returns the new list.

This variant will only sort basic data types

Code Flags:
CONSTANT
Example:
list nl = sort(l);
Parameters
lthe list to sort
Returns
the sorted list
See also

◆ sort() [3/4]

list Qore::sort ( list  l,
string  func 
)

Performs an unstable sort in ascending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY
Example:
list nl = sort(l, "my_sort_function");
Parameters
lthe list to sort
functhe name of a function accessible in the current scope that accepts 2 arguments of the data type in the list; the function must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also

◆ sort() [4/4]

list Qore::sort ( list  l,
code  f 
)

Performs an unstable sort in ascending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY
Example:
code sort_func = int sub (hash l, hash r) { return l.id <=> r.id; };
list nl = sort(l, sort_func);
Parameters
lthe list to sort
fa call reference or a closure that accepts 2 arguments of the data type in the list; the code must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also

◆ sort_descending() [1/4]

any Qore::sort_descending ( any  arg)

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP

◆ sort_descending() [2/4]

list Qore::sort_descending ( list  l)

Performs an unstable sort in descending order and returns the new list.

This variant will only sort basic data types

Code Flags:
CONSTANT
Example:
list nl = sort_descending(l);
Parameters
lthe list to sort
Returns
the sorted list
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortDescending()

◆ sort_descending() [3/4]

list Qore::sort_descending ( list  l,
string  func 
)

Performs an unstable sort in descending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order.

Code Flags:
CONSTANT
Example:
list nl = sort_descending(l, "my_sort_function");
Parameters
lthe list to sort
functhe name of a function accessible in the current scope that accepts 2 arguments of the data type in the list; the function must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortDescending()

◆ sort_descending() [4/4]

list Qore::sort_descending ( list  l,
code  f 
)

Performs an unstable sort in descending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY
Example:
code sort_func = int sub (hash l, hash r) { return l.id <=> r.id; };
list nl = sort_descending(l, sort_func);
Parameters
lthe list to sort
fa call reference or a closure that accepts 2 arguments of the data type in the list; the code must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortDescending()

◆ sort_descending_stable() [1/4]

any Qore::sort_descending_stable ( any  arg)

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP

◆ sort_descending_stable() [2/4]

list Qore::sort_descending_stable ( list  l)

Performs a stable sort in descending order and returns the new list.

This variant will only sort basic data types

Code Flags:
CONSTANT
Example:
Parameters
lthe list to sort
Returns
the sorted list
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortDescendingStable()

◆ sort_descending_stable() [3/4]

list Qore::sort_descending_stable ( list  l,
string  func 
)

Performs a stable sort in descending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY
Example:
list nl = sort_descending_stable(l, "my_sort_function");
Parameters
lthe list to sort
functhe name of a function accessible in the current scope that accepts 2 arguments of the data type in the list; the function must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortDescendingStable()

◆ sort_descending_stable() [4/4]

list Qore::sort_descending_stable ( list  l,
code  f 
)

Performs a stable sort in descending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY
Example:
code sort_func = int sub (hash l, hash r) { return l.id <=> r.id; };
list nl = sort_descending_stable(l, sort_func);
Parameters
lthe list to sort
fa call reference or a closure that accepts 2 arguments of the data type in the list; the code must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortDescendingStable()

◆ sort_stable() [1/4]

any Qore::sort_stable ( any  arg)

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP

◆ sort_stable() [2/4]

list Qore::sort_stable ( list  l)

Performs a stable sort in ascending order and returns the new list.

This variant will only sort basic data types

Code Flags:
CONSTANT
Example:
list nl = sort_stable(l);
Parameters
lthe list to sort
Returns
the sorted list
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortStable()

◆ sort_stable() [3/4]

list Qore::sort_stable ( list  l,
string  func 
)

Performs a stable sort in ascending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY
Example:
list nl = sort_stable(l, "my_sort_function");
Parameters
lthe list to sort
functhe name of a function accessible in the current scope that accepts 2 arguments of the data type in the list; the function must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortStable()

◆ sort_stable() [4/4]

list Qore::sort_stable ( list  l,
code  f 
)

Performs a stable sort in ascending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY
Example:
code sort_func = int sub (hash l, hash r) { return l.id <=> r.id; };
list nl = sort_stable(l, sort_func);
Parameters
lthe list to sort
fa call reference or a closure that accepts 2 arguments of the data type in the list; the code must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortStable()

◆ sortDescending() [1/4]

any Qore::sortDescending ( any  arg)

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP, DEPRECATED

◆ sortDescending() [2/4]

list Qore::sortDescending ( list  l)

Performs an unstable sort in descending order and returns the new list.

This variant will only sort basic data types

Code Flags:
CONSTANT, DEPRECATED
Parameters
lthe list to sort
Returns
the sorted list
See also
Deprecated:
use sort_descending(); camel-case function names were deprecated in Qore 0.8.12

◆ sortDescending() [3/4]

list Qore::sortDescending ( list  l,
string  func 
)

Performs an unstable sort in descending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order.

Code Flags:
CONSTANT, DEPRECATED
Parameters
lthe list to sort
functhe name of a function accessible in the current scope that accepts 2 arguments of the data type in the list; the function must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also
Deprecated:
use sort_descending(); camel-case function names were deprecated in Qore 0.8.12

◆ sortDescending() [4/4]

list Qore::sortDescending ( list  l,
code  f 
)

Performs an unstable sort in descending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY, DEPRECATED
Parameters
lthe list to sort
fa call reference or a closure that accepts 2 arguments of the data type in the list; the code must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also
Deprecated:
use sort_descending(); camel-case function names were deprecated in Qore 0.8.12

◆ sortDescendingStable() [1/4]

any Qore::sortDescendingStable ( any  arg)

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP, DEPRECATED

◆ sortDescendingStable() [2/4]

list Qore::sortDescendingStable ( list  l)

Performs a stable sort in descending order and returns the new list.

This variant will only sort basic data types

Code Flags:
CONSTANT, DEPRECATED
Example:
list nl = sortDescendingStable(l);
Parameters
lthe list to sort
Returns
the sorted list
See also
Deprecated:
use sort_descending_stable(); camel-case function names were deprecated in Qore 0.8.12

◆ sortDescendingStable() [3/4]

list Qore::sortDescendingStable ( list  l,
string  func 
)

Performs a stable sort in descending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY, DEPRECATED
Example:
list nl = sortDescending(l, "my_sort_function");
Parameters
lthe list to sort
functhe name of a function accessible in the current scope that accepts 2 arguments of the data type in the list; the function must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also
Deprecated:
use sort_descending_stable(); camel-case function names were deprecated in Qore 0.8.12

◆ sortDescendingStable() [4/4]

list Qore::sortDescendingStable ( list  l,
code  f 
)

Performs a stable sort in descending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY, DEPRECATED
Example:
code sort_func = int sub (hash l, hash r) { return l.id <=> r.id; };
list nl = sortDescending(l, sort_func);
Parameters
lthe list to sort
fa call reference or a closure that accepts 2 arguments of the data type in the list; the code must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also
Deprecated:
use sort_descending_stable(); camel-case function names were deprecated in Qore 0.8.12

◆ sortStable() [1/4]

any Qore::sortStable ( any  arg)

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
NOOP, DEPRECATED

◆ sortStable() [2/4]

list Qore::sortStable ( list  l)

Performs a stable sort in ascending order and returns the new list.

This variant will only sort basic data types

Code Flags:
CONSTANT, DEPRECATED
Parameters
lthe list to sort
Returns
the sorted list
See also
Deprecated:
use sort_stable(); camel-case function names were deprecated in Qore 0.8.12

◆ sortStable() [3/4]

list Qore::sortStable ( list  l,
string  func 
)

Performs a stable sort in ascending order and returns the new list; accepts the name of a function to use to sort complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY, DEPRECATED
Parameters
lthe list to sort
functhe name of a function accessible in the current scope that accepts 2 arguments of the data type in the list; the function must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also
Deprecated:
use sort_stable(); camel-case function names were deprecated in Qore 0.8.12

◆ sortStable() [4/4]

list Qore::sortStable ( list  l,
code  f 
)

Performs a stable sort in ascending order and returns the new list; accepts a call reference or a closure to use to sort complex data types or to give a special sort order.

Code Flags:
RET_VALUE_ONLY, DEPRECATED
Example:
code sort_func = int sub (hash l, hash r) { return l.id <=> r.id; };
list nl = sortStable(l, sort_func);
Parameters
lthe list to sort
fa call reference or a closure that accepts 2 arguments of the data type in the list; the code must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively
Returns
the sorted list
See also
Deprecated:
use sort_stable(); camel-case function names were deprecated in Qore 0.8.12