mapList (Function)

Signature: mapList(list: List<t0>, function: (t0) -> t1) -> List<t1>

Description: Returns a new list by applying a function to every element, in index order.

Parameters

  • list (List<t0>): The list
  • function ((t0) -> t1): The transformation function

Returns: List<t1>

Example

let doubled = mapList([1, 2, 3], fn(n) => satMul(n, 2))  // [2, 4, 6]
doubled = mapList ([1, 2, 3], \n => satMul (n, 2))  // [2, 4, 6]