Function
chain_
(
E: Equivalence.Equivalence<B>
)
Source from the content-addressed store, hash-verified
| 203 | * Map + Flatten |
| 204 | */ |
| 205 | export function chain_<B>( |
| 206 | E: Equivalence.Equivalence<B> |
| 207 | ): <A>(set: Set<A>, f: (x: A) => Set<B>) => Set<B> { |
| 208 | const elemE = elem_(E) |
| 209 | return (set, f) => { |
| 210 | const r = new Set<B>() |
| 211 | set.forEach((e) => { |
| 212 | f(e).forEach((e) => { |
| 213 | if (!elemE(r, e)) { |
| 214 | r.add(e) |
| 215 | } |
| 216 | }) |
| 217 | }) |
| 218 | return r |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * `true` if and only if every element in the first set is an element of the second set |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…