Skip to content
Ivan Pidhurskyi edited this page Nov 26, 2025 · 1 revision

List Type

type list(T)

A polymorphic linked list type. Lists are constructed using the cons operator : or the list() function.

Constructors:

  • x : xs - Non-empty list with head and tail
  • [] - Empty list
  • [x1, x2, ...] - List literal/constructor

Operations:

  • list[index] - Access element at index
  • length(list) - Get length of list
  • list1 + list2 - Concatenate two lists
  • reverse(list) - Reverse the list
  • map(list, fn) - Apply function to each element
  • foreach(list, fn) - Iterate over list with side effects

Clone this wiki locally