listPrepend (Function)

Signature: listPrepend(list: List<t0>, value: t0) -> List<t0>

Description: Returns a new list with value at the front. O(n).

Parameters

  • list (List<t0>): The list
  • value (t0): Value to prepend

Returns: List<t0>

Example

let prepended = listPrepend([2, 3], 1)  // [1, 2, 3]
prepended = listPrepend ([2, 3], 1)  // [1, 2, 3]