Hyperlinkv0.8.0-beta.28

Chunk

Chunk.reverseconsteffect/Chunk.ts:508
<S extends Chunk<any>>(self: S): Chunk.With<S, Chunk.Infer<S>>

Reverses the order of elements in a Chunk.

When to use

Use to read or process chunk elements in reverse order.

Details

If the input chunk is a NonEmptyChunk, the reversed chunk is also a NonEmptyChunk.

Example (Reversing chunks)

import { Chunk } from "effect"

const chunk = Chunk.make(1, 2, 3)
const result = Chunk.reverse(chunk)

console.log(Chunk.toArray(result)) // [3, 2, 1]
elements
Source effect/Chunk.ts:5081 lines
export const reverse: <S extends Chunk<any>>(self: S) => Chunk.With<S, Chunk.Infer<S>> = reverseChunk as any
Referenced by 1 symbols