effect-io-ai

Package: effect
Module: MutableHashSet

MutableHashSet.add

Checks whether the MutableHashSet contains the given element, and adds it if not.

Time complexity: O(1) average

Syntax

import { MutableHashSet, pipe } from "effect"

// with data-last, a.k.a. pipeable API
pipe(
  MutableHashSet.empty(),
  MutableHashSet.add(0),
  MutableHashSet.add(0)
)

// or piped with the pipe function
MutableHashSet.empty().pipe(MutableHashSet.add(0))

// or with data-first API
MutableHashSet.add(MutableHashSet.empty(), 0)

See

Signature

declare const add: { <V>(key: V): (self: MutableHashSet<V>) => MutableHashSet<V>; <V>(self: MutableHashSet<V>, key: V): MutableHashSet<V>; }

Source

Since v2.0.0