system.collection

The system.collection module provides higher-order functions for working with arrays and collections.

Import

import system.collection as c;

Functions

Transformation

Queries

Array Operations

Example

import system.collection as c;
import system.io as io;

let nums = [1, 2, 3, 4, 5];

// Map: double each number
let doubled = c.map(nums, (x) => x * 2);
io.out.println(doubled);  // [2, 4, 6, 8, 10]

// Filter: keep even numbers
let evens = c.filter(nums, (x) => x % 2 == 0);
io.out.println(evens);  // [2, 4]

// Reduce: sum all numbers
let sum = c.reduce(nums, (acc, x) => acc + x, 0);
io.out.println("Sum:", sum);  // 15