Options
All
  • Public
  • Public/Protected
  • All
Menu

Class List<A>

An immutable singly linked list data-structure

Type parameters

  • A

Hierarchy

  • List

Implements

Index

Properties

Accessors

Methods

Properties

Abstract head

head: A

Returns the head of a List

Abstract isEmpty

isEmpty: boolean

Returns true if the list is empty

Abstract tail

tail: List<A>

Returns the complete list without the first element

Accessors

asArray

  • get asArray(): A[]

reverse

  • get reverse(): List<A>

Methods

filter

  • filter(F: function): List<A>

fold

  • fold<B>(seed: B, ab: function): B
  • Transforms the List into a value

    Type parameters

    • B

    Parameters

    • seed: B
    • ab: function
        • (a: A, b: B): B
        • Parameters

          • a: A
          • b: B

          Returns B

    Returns B

map

  • map<B>(ab: function): List<B>
  • Transforms the values of the linked list

    Type parameters

    • B

    Parameters

    • ab: function
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    Returns List<B>

prepend

  • prepend(element: A): List<A>

reduce

  • reduce(ab: function): A
  • Folds the original list into a value of the same type

    Parameters

    • ab: function
        • (a: A, b: A): A
        • Parameters

          • a: A
          • b: A

          Returns A

    Returns A

Static empty

  • empty<A>(): List<A>

Static of

  • of<A>(...element: A[]): List<A>

Generated using TypeDoc