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): The list
  • function ((t0) -> t1): The transformation function

Returns: List

Example

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