Qore Programming Language Reference Manual  0.9.3.2
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 (auto arg, softlist< auto > 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 (auto arg, softlist< auto > 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...
 
auto Qore::max (list< auto > l)
 Returns the maximum value in a list. More...
 
auto Qore::max (list< auto > 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...
 
auto Qore::max (list< auto > 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...
 
auto Qore::max (...)
 Returns the maximum value of the arguments passed to the function. More...
 
auto Qore::min (list< auto > l)
 Returns the minumum value in a list. More...
 
auto Qore::min (list< auto > 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...
 
auto Qore::min (list< auto > 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...
 
auto Qore::min (...)
 Returns the minumum value of the arguments passed to the function. More...
 
list< intQore::range (int start, int stop, int step=1)
 Returns a list containing an arithmetic progression of integers. More...
 
list< intQore::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< auto > Qore::reverse (list< auto > l)
 Reverses a list and returns the new list. More...
 
auto Qore::sort (auto 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< auto > Qore::sort (list< auto > l)
 Performs an unstable sort in ascending order and returns the new list. More...
 
list< auto > Qore::sort (list< auto > 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< auto > Qore::sort (list< auto > 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...
 
auto Qore::sortDescending (auto 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< auto > Qore::sortDescending (list< auto > l)
 Performs an unstable sort in descending order and returns the new list. More...
 
list< auto > Qore::sortDescending (list< auto > 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< auto > Qore::sortDescending (list< auto > 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...
 
auto Qore::sortDescendingStable (auto 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< auto > Qore::sortDescendingStable (list< auto > l)
 Performs a stable sort in descending order and returns the new list. More...
 
list< auto > Qore::sortDescendingStable (list< auto > 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< auto > Qore::sortDescendingStable (list< auto > 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...
 
auto Qore::sortStable (auto 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< auto > Qore::sortStable (list< auto > l)
 Performs a stable sort in ascending order and returns the new list. More...
 
list< auto > Qore::sortStable (list< auto > 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< auto > Qore::sortStable (list< auto > 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...
 
auto Qore::sort_descending (auto 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< auto > Qore::sort_descending (list< auto > l)
 Performs an unstable sort in descending order and returns the new list. More...
 
list< auto > Qore::sort_descending (list< auto > 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< auto > Qore::sort_descending (list< auto > 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...
 
auto Qore::sort_descending_stable (auto 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< auto > Qore::sort_descending_stable (list< auto > l)
 Performs a stable sort in descending order and returns the new list. More...
 
list< auto > Qore::sort_descending_stable (list< auto > 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< auto > Qore::sort_descending_stable (list< auto > 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...
 
auto Qore::sort_stable (auto 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< auto > Qore::sort_stable (list< auto > l)
 Performs a stable sort in ascending order and returns the new list. More...
 
list< auto > Qore::sort_stable (list< auto > 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< auto > Qore::sort_stable (list< auto > 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 ( auto  arg,
softlist< auto >  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(auto, softlist<auto>)

◆ 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 ( auto  arg,
softlist< auto >  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(auto, softlist<auto>)

◆ max() [1/4]

auto Qore::max ( list< auto >  l)

Returns the maximum value in a list.

This variant will only work on basic data types

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

◆ max() [2/4]

auto Qore::max ( list< auto >  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:
auto 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]

auto Qore::max ( list< auto >  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; };
auto 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]

auto 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:
auto 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]

auto Qore::min ( list< auto >  l)

Returns the minumum value in a list.

This variant will only work on basic data types

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

◆ min() [2/4]

auto Qore::min ( list< auto >  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:
auto 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]

auto Qore::min ( list< auto >  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; };
auto 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]

auto 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:
auto 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<int> 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<int> 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<auto> Qore::reverse ( list< auto >  l)

Reverses a list and returns the new list.

Code Flags:
CONSTANT
Example:
list<auto> 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]

auto Qore::sort ( auto  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<auto> Qore::sort ( list< auto >  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<auto> nl = sort(l);
Parameters
lthe list to sort
Returns
the sorted list
See also
  • sortStable(list)
  • sortDescendingStable(list)
  • sortDescending(list)

◆ sort() [3/4]

list<auto> Qore::sort ( list< auto >  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<auto> 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
  • sortStable(list, string)
  • sortDescendingStable(list, string)
  • sortDescending(list, string)

◆ sort() [4/4]

list<auto> Qore::sort ( list< auto >  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<auto> 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
  • sortStable(list, code)
  • sortDescendingStable(list, code)
  • sortDescending(list, code)

◆ sort_descending() [1/4]

auto Qore::sort_descending ( auto  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<auto> Qore::sort_descending ( list< auto >  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<auto> nl = sort_descending(l);
Parameters
lthe list to sort
Returns
the sorted list
See also
  • sort(list)
  • sortDescendingStable(list)
  • sortStable(list)
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortDescending()

◆ sort_descending() [3/4]

list<auto> Qore::sort_descending ( list< auto >  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<auto> 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
  • sort_stable(list, string)
  • sort_descendingStable(list, string)
  • sort(list, string)
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortDescending()

◆ sort_descending() [4/4]

list<auto> Qore::sort_descending ( list< auto >  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<auto> 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
  • sort_stable(list, code)
  • sort_descendingStable(list, code)
  • sort(list, code)
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortDescending()

◆ sort_descending_stable() [1/4]

auto Qore::sort_descending_stable ( auto  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<auto> Qore::sort_descending_stable ( list< auto >  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:
list<auto> nl = sort_descending_stable(l);
Parameters
lthe list to sort
Returns
the sorted list
See also
  • sort_stable(list, code)
  • sort_descending_stable(list, code)
  • sort(list, code)
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortDescendingStable()

◆ sort_descending_stable() [3/4]

list<auto> Qore::sort_descending_stable ( list< auto >  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<auto> 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
  • sort_stable(list, code)
  • sort_descending_stable(list, code)
  • sort(list, code)
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortDescendingStable()

◆ sort_descending_stable() [4/4]

list<auto> Qore::sort_descending_stable ( list< auto >  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<auto> 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
  • sort_stable(list, code)
  • sort_descending_stable(list, code)
  • sort(list, code)
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortDescendingStable()

◆ sort_stable() [1/4]

auto Qore::sort_stable ( auto  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<auto> Qore::sort_stable ( list< auto >  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<auto> nl = sort_stable(l);
Parameters
lthe list to sort
Returns
the sorted list
See also
  • sort(list, string)
  • sort_descending(list, string)
  • sort_descending_stable(list, string)
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortStable()

◆ sort_stable() [3/4]

list<auto> Qore::sort_stable ( list< auto >  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<auto> 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
  • sort(list, string)
  • sort_descending(list, string)
  • sort_descending_stable(list, string)
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortStable()

◆ sort_stable() [4/4]

list<auto> Qore::sort_stable ( list< auto >  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<auto> l, hash<auto> r) { return l.id <=> r.id; };
list<auto> 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
  • sort(list, string)
  • sort_descending(list, string)
  • sort_descending_stable(list, string)
Since
Qore 0.8.12 as a replacement for deprecated camel-case sortStable()

◆ sortDescending() [1/4]

auto Qore::sortDescending ( auto  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<auto> Qore::sortDescending ( list< auto >  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
  • sort(list)
  • sortDescendingStable(list)
  • sortStable(list)
Deprecated:
use sort_descending(); camel-case function names were deprecated in Qore 0.8.12

◆ sortDescending() [3/4]

list<auto> Qore::sortDescending ( list< auto >  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
  • sortStable(list, string)
  • sortDescendingStable(list, string)
  • sort(list, string)
Deprecated:
use sort_descending(); camel-case function names were deprecated in Qore 0.8.12

◆ sortDescending() [4/4]

list<auto> Qore::sortDescending ( list< auto >  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
  • sortStable(list, code)
  • sortDescendingStable(list, code)
  • sort(list, code)
Deprecated:
use sort_descending(); camel-case function names were deprecated in Qore 0.8.12

◆ sortDescendingStable() [1/4]

auto Qore::sortDescendingStable ( auto  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<auto> Qore::sortDescendingStable ( list< auto >  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<auto> nl = sortDescendingStable(l);
Parameters
lthe list to sort
Returns
the sorted list
See also
  • sort_stable(list, code)
  • sort_descending_stable(list, code)
  • sort(list, code)
Deprecated:
use sort_descending_stable(); camel-case function names were deprecated in Qore 0.8.12

◆ sortDescendingStable() [3/4]

list<auto> Qore::sortDescendingStable ( list< auto >  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<auto> 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
  • sort_stable(list, code)
  • sort_descending_stable(list, code)
  • sort(list, code)
Deprecated:
use sort_descending_stable(); camel-case function names were deprecated in Qore 0.8.12

◆ sortDescendingStable() [4/4]

list<auto> Qore::sortDescendingStable ( list< auto >  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<auto> 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
  • sort_stable(list, code)
  • sort_descending_stable(list, code)
  • sort(list, code)
Deprecated:
use sort_descending_stable(); camel-case function names were deprecated in Qore 0.8.12

◆ sortStable() [1/4]

auto Qore::sortStable ( auto  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<auto> Qore::sortStable ( list< auto >  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
  • sort(list, string)
  • sort_descending(list, string)
  • sort_descending_stable(list, string)
Deprecated:
use sort_stable(); camel-case function names were deprecated in Qore 0.8.12

◆ sortStable() [3/4]

list<auto> Qore::sortStable ( list< auto >  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
  • sort(list, string)
  • sort_descending(list, string)
  • sort_descending_stable(list, string)
Deprecated:
use sort_stable(); camel-case function names were deprecated in Qore 0.8.12

◆ sortStable() [4/4]

list<auto> Qore::sortStable ( list< auto >  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<auto> 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
  • sort(list, string)
  • sort_descending(list, string)
  • sort_descending_stable(list, string)
Deprecated:
use sort_stable(); camel-case function names were deprecated in Qore 0.8.12