MCPcopy Create free account
hub / github.com/effect-app/libs / fromArray

Function fromArray

packages/effect-app/src/Set.ts:507–520  ·  view source on GitHub ↗
(E: Equivalence.Equivalence<A>)

Source from the content-addressed store, hash-verified

505 * Create a set from an array
506 */
507export function fromArray<A>(E: Equivalence.Equivalence<A>): (as: ReadonlyArray<A>) => Set<A> {
508 return (as) => {
509 const len = as.length
510 const r = new Set<A>()
511 const has = elem_(E)
512 for (let i = 0; i < len; i++) {
513 const a = as[i]!
514 if (!has(r, a)) {
515 r.add(a)
516 }
517 }
518 return r
519 }
520}
521
522/**
523 * Set compaction, remove none

Callers 3

concat_Function · 0.90
make_Function · 0.90
make_Function · 0.70

Calls 3

elem_Function · 0.85
addMethod · 0.65
hasFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…