/** * Constructs a new `List` from an `Iterable` * * @tsplus static List.Ops from * @tsplus getter Collection toList */ export function from(prefix: Collection): List { const iter = prefix[Symbol.iterator]() let a: IteratorResult if (!(a = iter.next()).done) { const result = List.cons(a.value, List.nil()) let curr = result while (!(a = iter.next()).done) { const temp = List.cons(a.value, List.nil()) curr.tail = temp curr = temp } return result } else { return List.nil() } } /** * Constructs a new `List` from an `Iterable` * * @tsplus static List.Ops __call * @tsplus static List.Ops make */ export function make(...prefix: As): List { return from(prefix) }