Hyperlinkv0.8.0-beta.28

Array

Array.differenceconsteffect/Array.ts:3301
<A>(that: Iterable<A>): (self: Iterable<A>) => Array<A>
<A>(self: Iterable<A>, that: Iterable<A>): Array<A>

Computes elements in the first array that are not in the second, using Equal.equivalence().

When to use

Use when you need to keep values from the first array that are absent from the second and the default Equal.equivalence() comparison is appropriate.

Example (Computing array differences)

import { Array } from "effect"

console.log(Array.difference([1, 2, 3], [2, 3, 4])) // [1]
Source effect/Array.ts:33014 lines
export const difference: {
  <A>(that: Iterable<A>): (self: Iterable<A>) => Array<A>
  <A>(self: Iterable<A>, that: Iterable<A>): Array<A>
} = differenceWith(Equal.asEquivalence())
Referenced by 1 symbols