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

logo

Cello High Level C

Methods

len

size_t len(var self);

Returns the length of object self.

Examples

Usage

var x = new(Array, Int, $I(1), $I(2), $I(5));
show($I(len(x))); /* 3 */
var y = $S("Test");
show($I(len(y))); /* 4 */

Len


Has a length

The Len class can be implemented by any type that has a length associated with it. It is typically implemented by collections and is often used in conjunction with Iter or Get.

Definition

struct Len {
  size_t (*len)(var);
};

Implementers

  • Array |     Sequential Container
  • Exception |     Exception Object
  • List |     Linked List
  • Map |     Apply Function to Iterable
  • Range |     Integer Sequence
  • Slice |     Partial Iterable
  • String |     String Object
  • Table |     Hash table
  • Tree |     Balanced Binary Tree
  • Tuple |     Basic Collection
  • Zip |     Multiple Iterator

Back