<B>(head: B): <A>(self: Iterable<A>) => Iterable<A | B>
<A, B>(self: Iterable<A>, head: B): Iterable<A | B>Prepends an element to the front of an Iterable, creating a new Iterable.
Example (Prepending an element)
import { Iterable } from "effect"
const numbers = [2, 3, 4]
const withOne = Iterable.prepend(numbers, 1)
console.log(Array.from(withOne)) // [1, 2, 3, 4]
// Works with any iterable
const letters = "abc"
const withZ = Iterable.prepend(letters, "z")
console.log(Array.from(withZ)) // ["z", "a", "b", "c"]combining
Source effect/Iterable.ts:2214 lines
export const const prepend: {
<B>(head: B): <A>(
self: Iterable<A>
) => Iterable<A | B>
<A, B>(self: Iterable<A>, head: B): Iterable<
A | B
>
}
Prepends an element to the front of an Iterable, creating a new Iterable.
Example (Prepending an element)
import { Iterable } from "effect"
const numbers = [2, 3, 4]
const withOne = Iterable.prepend(numbers, 1)
console.log(Array.from(withOne)) // [1, 2, 3, 4]
// Works with any iterable
const letters = "abc"
const withZ = Iterable.prepend(letters, "z")
console.log(Array.from(withZ)) // ["z", "a", "b", "c"]
prepend: {
<function (type parameter) B in <B>(head: B): <A>(self: Iterable<A>) => Iterable<A | B>B>(head: Bhead: function (type parameter) B in <B>(head: B): <A>(self: Iterable<A>) => Iterable<A | B>B): <function (type parameter) A in <A>(self: Iterable<A>): Iterable<A | B>A>(self: Iterable<A>self: interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A>(self: Iterable<A>): Iterable<A | B>A>) => interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A>(self: Iterable<A>): Iterable<A | B>A | function (type parameter) B in <B>(head: B): <A>(self: Iterable<A>) => Iterable<A | B>B>
<function (type parameter) A in <A, B>(self: Iterable<A>, head: B): Iterable<A | B>A, function (type parameter) B in <A, B>(self: Iterable<A>, head: B): Iterable<A | B>B>(self: Iterable<A>self: interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A, B>(self: Iterable<A>, head: B): Iterable<A | B>A>, head: Bhead: function (type parameter) B in <A, B>(self: Iterable<A>, head: B): Iterable<A | B>B): interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A, B>(self: Iterable<A>, head: B): Iterable<A | B>A | function (type parameter) B in <A, B>(self: Iterable<A>, head: B): Iterable<A | B>B>
} = import dualdual(2, <function (type parameter) A in <A, B>(self: Iterable<A>, head: B): Iterable<A | B>A, function (type parameter) B in <A, B>(self: Iterable<A>, head: B): Iterable<A | B>B>(self: Iterable<A>self: interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A, B>(self: Iterable<A>, head: B): Iterable<A | B>A>, head: Bhead: function (type parameter) B in <A, B>(self: Iterable<A>, head: B): Iterable<A | B>B): interface Iterable<T, TReturn = any, TNext = any>Iterable<function (type parameter) A in <A, B>(self: Iterable<A>, head: B): Iterable<A | B>A | function (type parameter) B in <A, B>(self: Iterable<A>, head: B): Iterable<A | B>B> => const prependAll: <A, B>(self: Iterable<A>, that: Iterable<B>) => Iterable<A | B> (+1 overload)prependAll(self: Iterable<A>self, [head: Bhead]))