/** * @tsplus static List.Aspects prependAll * @tsplus pipeable List prependAll */ export function prependAll(prefix: List) { return (self: List): List => { if (self.isNil()) { return prefix } else if (prefix.isNil()) { return self } else { const result = List.cons(prefix.head, self) let curr = result let that = prefix.tail while (!that.isNil()) { const temp = List.cons(that.head, self) curr.tail = temp curr = temp that = that.tail } return result } } }