• Computes a string displaying the contents of the list aList. This function is curried, takes a printing function for the values as first parameter, and then returns a function taking the list to display.

    Parameters

    • dispFun: ((a: any) => string) = ...

      a function that displays a single element

        • (a): string
        • Parameters

          • a: any

          Returns string

    Returns ((a: List<any>) => string)

    a function displaying a list

      • (a): string
      • Parameters

        Returns string

    listToString()(cons(1, cons(2, nil)))                     // -> "(|1, 2|)"
    listToString((x) => ".".repeat(x))(cons(1, cons(2, nil))) // -> "(|., ..|)"