« Home » « Learn » « Download » « Github »

logo

Cello High Level C

Methods

sort

void sort(var self);

Sorts the object self.

sort_by

void sort_by(var self, bool(*f)(var,var));

Sorts the object self using the function f.

Examples

Usage

var x = new(Array, Float, 
  $F(5.2), $F(7.1), $F(2.2));

show(x); /* <'Array' At 0x00414603 [5.2, 7.1, 2.2]> */
sort(x);
show(x); /* <'Array' At 0x00414603 [2.2, 5.2, 7.1]> */

Sort


Sortable

The Sort class can be implemented by types which can be sorted in some way such as Array. By default the sorting function uses the lt method to compare elements, but a custom function can also be provided.

Definition

struct Sort {
  void (*sort_by)(var,bool(*f)(var,var));
};

Implementers

  • Array |     Sequential Container
  • Tuple |     Basic Collection

Back